R
R
ReFeRy2017-11-09 11:32:09
PHP
ReFeRy, 2017-11-09 11:32:09

Is it worth it to try to stick the cache wherever possible (memcached, php project)?

There is a working site, a content project with UGC. Lots of user actions, lots of text content. The site runs on one server, the main storage of mysql information, memchache is used for caching.
The load ratio is as follows:
MySQL: 101 requests per second, 2 GB of traffic per hour
Memcache: 40 requests per second, 600 MB of traffic per hour
Traffic: 40k uniques, 350k views per day (and many more actions via AJAX).
I understand that there is no silver bullet, but maybe someone from their experience will say - is it worth trying to shift the load on the cache in cases where the savings come out scanty? For example, now the cache is practically not used in blogs, comments, personal messages - there are a lot of updates there, the benefit from introducing the cache will be scanty, and there will be a lot of coding.
PS The site is written in pure php, communication with mysql through the bike. So far, I have sent to the cache those queries that iterate over large tables, or are requested hundreds/thousands of times between data changes.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey, 2017-11-09
@VELIK505

The load ratio is as follows:
MySQL: 101 requests per second, 2 GB traffic per hour
Memcache: 40 requests per second, 600 MB traffic per hour

It's nothing at all... I would even say it's minuscule... It's
better to optimize heavy sql queries, if there are any.

R
RidgeA, 2017-11-09
@RidgeA

1. You can cache everything that allows you to cache business logic. A meager increase in 10 places can give a total better increase, because. these meager requests will not once again force the base and the base will be able to serve requests faster.
2. You can cache pages and http requests at the web server level, the request should not reach php at all - this can give an increase in overall performance.
3. If this is something like a blog, where posts do not change so often, or even do not change at all, you can generate the main pages in ready-made html and give them as static via a web server. Change these pages on the server in case of any change.

A
Alexander Kubintsev, 2017-11-16
@akubintsev

I understand that there is no silver bullet, but maybe someone from their experience will say - is it worth trying to shift the load on the cache in cases where the savings come out scanty? For example, now the cache is practically not used in blogs, comments, personal messages - there are a lot of updates there, the benefit from introducing the cache will be scanty, and there will be a lot of coding.

Not worth it.
Cache management is a complex task. And if you cache everything, then it is easy to get an inconsistent state and understand where the trouble is not easy.
To answer your question only by weighing the entire project with metrics first.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question