K
K
Khaybulla Musaev2015-11-27 16:53:45
linux
Khaybulla Musaev, 2015-11-27 16:53:45

Is it possible to control the load on the processor?

Hello dear developers!
I wrote a simple php script for myself , which should take pictures in one place, compress and put them in another. Up to 1000 photos will be processed at once.
My vds- provider indicated that excessive load on the processor or disk system is fraught with a shutdown. Now it turned out that in matters of understanding the basic architecture, I sag a lot.
Here are a few questions on this topic:
1) Is it possible to somehow control the script ? Is this real or a fairy tale?
2) Or is this issue somehow solved by interrupting the script?.. For example, sleep after any time-consuming resources.
3) And that's what the situation is not clear to me - today I launched a long unzip archive on vds . CPU load is relatively stable at 50%. Then I ran my script - it worked for 255 seconds and loaded the processor by 98% . There is already a question about a common understanding - why does one process load by 50% , another can by 98% , the third can safely work at low loads ... Does it all depend on how many operations you have to perform? .. Happy Friday everyone :)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Melkij, 2015-11-27
@melkij

First, move to a normal VPS. Why do you need a hoster that does not provide you with the promised resources?
The VPS hoster must provide all the resources that he promised.
1) look in cgroup
2) this is also possible. But why?
3) there is always some kind of bottleneck. If there is a complete utilization of the CPU, it means that they ran into it. If the CPU is not completely utilized, it means that they ran into something else. In I / O (disk, network), memory or something else. Unpacking a fairly simple zip'a - most likely ran into a disk.

O
Optimus, 2015-11-27
Pyan @marrk2

So do you have VDS or hosting? On VDS, you can usually fully use server resources at least 100%
. In the case of hosting, you need to select the load according to the upper limit by reducing the one-time bundle and running the script via cron for even distribution, and you can set sleep() inside the loop.
What kind of VDS you have is even interesting, whisper to me the hosting provider in the comments.

L
link_irk, 2015-11-27
@link_irk

It all depends on how your script is written in terms of optimality. Maybe you should use application utilities for batch processing images, such as imagemagick?

S
sim3x, 2015-11-27
@sim3x

man nice
But it's better to save a couple of breakfasts and buy a normal
serverbear.com/compare/lowendbox

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question