Reputation: 1769
With the new project I develop, i choosed the json-rpc way, with client side templates and alot of javascript stuff. The problem is - apache with php (actually php parses json query) is pretty slow. I have approximately 20 queries per page and it takes long time to have everything loaded.
My dream is to get it possible, to connect javascript directly with tcp/ip protocol to backend (written in php) but I know it's not possible (without flash).
Can you please give me any suggestion, how to improve speed of this solution? Maybe replacing apache with nginx or even write dedicated httpd may help?
Upvotes: 2
Views: 1103
Reputation: 106
Your case is not trivial, so solution is not trivial too.
phpDaemon is a high performance true-Fast-CGI solution. With phpDaemon, your code will run without overhead for initialization, so once time initialized, script can process a lot of requests with furious speed.
Upvotes: 1
Reputation: 154574
If you're making 20 queries per page, I doubt a better data interchange format will help a whole lot. Unless you're dealing with a huge amount of JSON, my guess is that the simplest way to get a performance boost will be to reduce the number of queries (possibly by batching them).
Some other things that might help: make sure Apache has enough spare processes using MinSpareServers, make sure all the JSON is being gzip'd (eg, using mod_deflate
), profile your code to verify that decoding the JSON is actually what's slow, and the time isn't going into, eg, a slow DB query.
Upvotes: 2