Question

I've created PHP application for Facebook. It uses MySQL, Memcached and works on Lighttpd on Centos 2,6 Ghz and 2 GB RAM.

it's basically one PHP file that after first run is cached and every next time it's served in 0,8 ms directly from Memcached.

What more can I do to shorten this time?

Was it helpful?

Solution

Once you get to 0.8 ms, I'm not sure you can go any lower.

However, you can set up multiple servers to handle many concurrent requests (with a common memcached). You will then be able to scale very high by simply adding a new server when you reach limits.

OTHER TIPS

Run XDebug and run the profiler. There you can see if you have any functions that take an abnormal length of time.

I recommend using a program that reads those logs. Like kcachegrind etc.

BTW, when you enter profiler country, there's no turning back.

You can put a http-proxy and load balance to multiple servers. Most http-proxies can double as a cache, which can take load off the application.

Also, make sure that you send the proper http headers, so that your pages are client-side cacheable. This may reduce the number of requests, as the clients will reuse their cached version.

Do you have a php script which gets data from memcached and displays them, or the web server itself gets data, directly from memcached?

I don't know if lighthttpd can display page directly from memcached, but i know nginx can do this google for ngx_http_memcached_module

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top