Best practice: profile before adding memcached?

howard chen howachen at
Tue Feb 6 13:54:08 UTC 2007

On 2/6/07, Jason Edgecombe <jedgecombe at> wrote:
> Brian Moon wrote:
> >> at the time the developer is writing the query, they should make sure
> >> the query is fast and efficient, if they are not sure, use the explain
> >> statements.
> >
> > Sure, but his question is specifically about adding memcached to an
> > existing application.  In that case, you are past the explain stage.
> > He needs to learn where the bottlenecks are for his application.  They
> > could not be SQL related at all.  We have found there are large blocks
> > of code that we want to skip and memcache the resulting data from them.
> >
> I'm actually not past the "explain" stage yet.  :( This application was
> coded in a hurry to meet a deadline. Now the site is experiencing
> growing pains, so now optimization is a priority.
> I'm a volunteer developer for the site, I just started a week ago.
> Jason

For your case: you should solve the slow query first (if any).

After that, try to find some frequently used queries for optimizing

>> mysqlsla is a good tool for these two jobs (

Finally, depending on the nature of your apps, you might consider ...

a. use Squid in front of your web sever
b. application caching (e.g. smarty, apc, memcached)
c. database replication

More information about the memcached mailing list