Answer the question
In order to leave comments, you need to log in
Why does VPS on OpenVZ consume more memory than KVM?
There are 2 VPS with similar characteristics: 1 core, 512MB of memory, Debian 9, Nginx + PHP7.0-FPM, MariaDB, the difference is only in the virtualization system.
Even at idle on a system with KVM, memory consumption is almost 3 times lower than on OpenVZ, what is the reason for this? I just know that OpenVZ is far from physical hardware, and manages memory in a different way, you can briefly or throw an article at me on this topic. Thank you.
Answer the question
In order to leave comments, you need to log in
Simplified, you can imagine it something like this:
There is a memory cell where some object is stored and there is a pointer to it (a variable). And there is a memory cell where some function is stored with this inside and there is a pointer to it (you can also say a variable, but it looks something like this - myObj.func
). When you call a function through a dot, myObj.func()
the interpreter sees the context in which the function is launched and where the value for this should be taken from.
But when you pass something like myObj.func
that to another function in parameters, only a pointer to a memory cell with a function is passed, the context is lost, and accordingly the passed entity is launched not as an object method, but as a regular function with this being undefined
And in the second case, you just pass in the parameters a pointer to the object itself, and not its method, and then you call the method in the context of this object, so everything works.
From the screen you can see that only 28 percent of the memory is occupied by processes in openz.
What are you asking about?
The principle of OpenVZ is one bucket for all and many, many user spaces pretending to be machines. Therefore, I would doubt the accuracy of the work of any program associated with the bucket, simply because half of the functions in the bucket are just fucking cut.
And KVM is an honest machine where everything is yours.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question