Answer the question
In order to leave comments, you need to log in
Why does PHP run much slower on my VPS (results of 2 tests)?
The other day I already asked a question on this topic.
There is a long text, and not a single test.
The text is so long that no one bothered to read it and some gave answers completely out of place.
This time it will be the other way around.
I'll start with tests.
So here are 2 tests:
test_disk.php:
<?php
$starttime = microtime(true);
file_get_contents('diskbump', true);
$endtime = microtime(true);
$timediff = $endtime - $starttime;
echo $timediff
?>
<?php
$starttime = microtime(true);
for ($i = 0; $i < 500000000; $i++) {
}
$endtime = microtime(true);
$timediff = $endtime - $starttime;
echo $timediff
?>
Answer the question
In order to leave comments, you need to log in
Batlab correctly answered above that on VDS processor resources are distributed through virtualization, and they are limited by the tariff plan, but guaranteed to each client.
On hosting, the distribution is different - all server resources can be used by all clients. Therefore, if you test hosting at a time when it is lightly loaded (say, at night from Saturday to Sunday), then the results on it will be better. But in those moments when the load from other clients grows on the hosting, the effect will be the opposite: the site will work slower than on VDS (although a lot still depends on the hoster itself).
Also, for a correct comparison, you need to take the same version of PHP both there and there (it affects synthetic tests like yours very much). And the test with the file will be strongly influenced by the disk cache.
The processors on the VPS are not dedicated cores, but virtual ones (which are created through virtualization systems). Each hosting provider distributes these resources itself, so, apparently, the hosting provider has allocated more resources. That's all.
and what kind of VPS
do I have, for example, 4 nuclear xeons at 3.9 gigahertz
On hosting, I allow the use of all 4 cores without restrictions
on dead VPS, I limit the core to 1 GHz, although the processor is the same there, that is, on the VPS, in fact, the processor is about 16 times less .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question