Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP performance on shared hosting

I have php script which calls another script with php exec function. The called script does batch process job, that is updating transaction statuses, notifies customers(puts emails to mail queue which runs separately). So it will take 20-30 minutes due to a very large table(500000 rows), Now i am running it under my desktop windows machine and php uses up to 50% CPU, mysql 20% CPU. Is it normal practice ? What if i put this script in a shared hosting ? Will i have trouble with that ? It will not break the shared hosting rules ? The batch process can be started by a user anytime(normally one a month or can be more frequently).

Any suggest on this ?

Thanks for reading.

like image 823
taras Avatar asked Dec 07 '25 12:12

taras


1 Answers

Almost certainly, however it depends how much CPU power is available to the shared host (probably about as much as your desktop to be honest), in which case you'll see yourself booted off in short order. Shared hosts tend to be stack-em-high affairs, where you can get 100s of sites hosted.

You could go for a virtual host, where they will give you freedom to do whatever you like, but you'll probably find there that the amount of CPU power you're restricted to is limited, possibly too limited for you. Virtual hosts tend to split the host between several virtual guests, sometimes as little as 4, but more often (and especially for the cheaper plans) all the way up to 64.

Your third option then is to go for a fully dedicated server, you get a whole server all you yourself and can do what you like with it. These tend to be expensive if you want lots of server hardware (because it uses a lot of very expensive electricity), or lots of bandwidth.

Obviously those 3 options increase in cost, in the webhosting arena, you do get what you pay for.

You might like to find a webhosting forum and ask around on there - be sure to specify the CPU requirements, and how long its likely to take. You may get some hoster that'll be more than happy for you to run your script in the 'out of hours' if you agree a time with them (that doesn't interfere with backups, or if they have lower resource time, as websites tend to be accessed around the world in every timezone)

like image 53
gbjbaanb Avatar answered Dec 10 '25 01:12

gbjbaanb