Forum Moderators: phranque

Message Too Old, No Replies

How to handle huge number of http requests

hosting

         

webprogramer

7:01 am on Mar 16, 2010 (gmt 0)

10+ Year Member



Hello Everyone!

I have a tiny PHP script and a large amount of customers who needs an access to it. Sometimes 30 000 requests per hour. My hosting provider shutdowns the service when requests reach 12 000. It says that my script is using to much CPU time.
Dedicated server is quite expensive for me now.

Are there any sollutions for my problem? Perhaps some cheap clouding computing?

Thank you.

tangor

7:37 am on Mar 16, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



With that kind of traffic I hope you are monetizing it so it would pay for the access! You can't be too specific as to what you are doing but is this file sharing or ordinary html page service?

webprogramer

7:48 am on Mar 16, 2010 (gmt 0)

10+ Year Member



This is PHP script which works like trasparent proxy, it pulls xml from other server

maximillianos

3:12 pm on Mar 16, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sounds like you require some decent horsepower, which costs money.

Are you tied to a domain name for this service? You could create 4-5 sub-domains for your service and run them each on a separate cheap hosting package... That might give you the horsepower you need and keep costs down.

The only problem is you would have to spread your requests out over the various sub-domains... Which you ISP might be able to do... or you could inform certain customers to use certain subdomains, etc.

creeking

7:29 pm on Mar 16, 2010 (gmt 0)

10+ Year Member



You could create 4-5 sub-domains for your service and run them each on a separate cheap hosting package


I wonder if the same thing could be accomplished by using five different nameservers, pointing to five different (but identical) webhosting accounts. benefit would be that the URL would not have to be changed.

phranque

10:48 pm on Mar 16, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you don't really need 5 name servers - 5 is ok but 2 or preferably 3 is enough.
it should be pointed out that a properly configured DNS avoids stealth or missing nameservers which essentially means that all nameservers are listed in all zone files.
each of these zone files would refer to the 5 web servers that would essentially be used in a round robin style.

lammert

12:10 am on Mar 17, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



A cheap dedicated server seems the best solution to me. The really cheap unmanaged versions won't cost much more than a high-end shared hosting package and you won't have any complaints of your hosting company anymore. Furthermore that server doesn't need extended facilities like daily backup etc, because you are saying it mainly works as a transparent proxy for another server, so there won't be much local data to backup.

If this is not an option, think about the possibility of caching the data for a small time. This could be a possibility if the XML data doesn't change too often and a small delay between new data on the server and the availability of that data to the client is not a big problem. Many large sites use caching with time periods of a few seconds to a few minutes to reduce server load, at the cost of a small propagation delay for fresh data.

If this script doesn't change too often, you might consider to precompile it, for example with the Zend PHP compiler, but in that case your hosting company must allow a change in the PHP environment in order to allow this script to be run. Not every host will be willing to do that in a shared hosting environment.

Just to be sure:
The hosting company told you that the CPU processing time is the problem and not the amount of open simultaneous HTTP requests? In the latter case you might consider to switch KeepAlive off (if the server is running Apache), because with KeepAlive switched on, each Apache instance will wait for a specific amount of time before closing the connection with the client, causing many idle Apache processes to consume memory.