开发者

Optimization question: Creating a Symfony "live" page (memcached)

Using: Symfony 1.4.13 (Propel ORM)

I am currently busy optimizing for traffic and I want to relieve the database of getting too many of the same calls.

The "live" page is an overview of articles. Every five seconds an ajax call is made to check for new articles. It works fine at the moment. But I want just one call every 5 seconds (cron job), not 100 calls when 100 users are on the same page at once.

Of course I can do it the old fashion way of just generating an XML document (or something similar) every 5 seconds and load/read that, 开发者_运维百科but I was wondering if you can do it with Memcached too. I'm pretty new to it, so any advice is appreciated. Is it possible to save objects and be accessible to all users? Or is there a better way?


You can create caches in two stages: You could create a query cache for Doctrine, but then you would still hit that cache for each request.

You can also use the (view) cache system in Symfony, for which you can use different 'stores', like APC and memcached. You can configure these cache providers any way you want. (So, in your case, set it's lifetime to 5 seconds).

You can read more about the Symfony cache system in the Jobeet tutorial.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜