views:

122

answers:

2

I have read this article about 400% boost of your website. This is done by a combination of nginx and memcached. The how-to part of this website is quite good, but i mis the part where it says to what types of websites this applies.

I know nginx is a http engine, I need no explanation for that.

I thought memcached had something to do with caching database result. However i don't understand what this has to do with the http request, can someone please explain that to me.

Another question I have is for what types of websites is this used. I have a website where the important part of the website consist of data that changes often. Often being minutes.

Will this method still apply to me, or should I just stick with the basic boring setup of apache and nothing else.

+1  A: 

From the memcached FAQ:

Adding memcached support to your application can be a lot of work. MySQL has a handy query cache feature that will automatically cache the results of your SQL queries, making them way faster on repeat runs. How does memcached compare to this? MySQL's query cache is centralized, so its benefits are seen by all servers connecting to it.

  • MySQL's query cache flushes as soon as you modify a table. You can store
    a memcached item for a minimum amount of time, but if you get a lot of
    write traffic, MySQL's query cache
    will be constantly expiring all
    entries

  • MySQL's query cache has scalability issues for many CPUs. It adds a
    global lock, and gets slower as it
    has to flush more queries.

  • You can't store arbitrary data objects into the cache. You can build much more efficient caches with
    memcached. Run several separate
    queries to build a user object, build the user object, then cache that.
    MySQL's query cache can help small
    sites, but can do more harm than good at scale.

  • Memory is limited to how much spare RAM you have on your database. It's
    much nicer to give your database more RAM to cache data :) With memcached
    you spread out the cluster wherever
    you have spare memory, so you can
    cache much much more.

jjclarkson
Thank you for copying these parts of the FAQ. Memcached has some good features. But this still does not explain for what types of websites the article in the question can be applied to. In the article memcached is used with a 5 minute setup. I doubt that can ever be true. I have read these faq's of memcached and know it is not that easy to set up, thats why I asked the question what the article describes exactly.
Saif Bechan
A: 

memcached is a generic memory data cache. It's probably most commonly used to cache database objects, but it can accomplish a large number of other tasks.

The particular article you linked is describing how to use nginx in place of the Mongrel httpd usually used for the Rails web framework. memcached is being used to cache the results of dynamic pages that use querystrings to generate the dynamic content; in this specific use case, it appears the page will generate identical results with an identical querystring each time, so significant performance gains can be had by simply bypassing appserver generation and caching the rendered HTML in memcached.

Despite the somewhat overhyped headline, the article is not giving a use case that is appropriate for all (or even most) dynamic web pages. But if you have pages which require a lot of computation and return the same results with the same parameters for all users (public search results are a good example), this solution will give you significant performance improvement.

Dan Story
So if I understand correctly every single html character of the desired website has to be the same. For example the url http://mydomain.com/articles/get-some-article has to be the same everytime a user requests is. If there are rapid changes on this article the whole setup would be useless.
Saif Bechan
Right. This is for pages that don't change at all between invocations as long as the parameters are the same. Note that pages which include, say, advertising in an iframe can still use this mechanism, since the iframe code will be static but the page loaded by the iframe can change.
Dan Story