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.
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.
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
entriesMySQL'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.
精彩评论