Why is the processor system time (% sy) high?

I am running a script that downloads large files. I ran the same script on one core of the OpenSuSe server and a quad-core PC. As expected on my PC, it is much faster than on the server. But the script slows down the server and makes it impossible to do anything else.

My script is there

for 100 iterations Load saved data (about 10 mb) 

myscript time (on PC)

 real 0m52.564s user 0m51.768s sys 0m0.524s 

myscript time (on server)

 real 32m32.810s user 4m37.677s sys 12m51.524s 

I wonder why "sys" is so high when I run the code on the server. I used the top command to check memory and CPU usage. enter image description here It seems that there is still free memory, so replacement is not the reason. % sy is so high that there is probably a reason for server speed, but I don’t know what causes% sy so high. The process using the highest percentage of CPU (99%) is "myscript". % wa is zero in the screenshot, but sometimes it gets very high (50%).

When the script is executed, the average load is greater than 1, but never equal to 2.

I also checked my drive:

 strt:~ # hdparm -tT /dev/sda /dev/sda: Timing cached reads: 16480 MB in 2.00 seconds = 8247.94 MB/sec Timing buffered disk reads: 20 MB in 3.44 seconds = 5.81 MB/sec john@strt :~> df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 245G 102G 131G 44% / udev 4.0G 152K 4.0G 1% /dev tmpfs 4.0G 76K 4.0G 1% /dev/shm 

I checked these things, but I'm still not sure what the real problem is on my server and how to fix it. Can anyone determine the likely cause of the slowness? What could be the solution? Or is there anything else I should check?

Thanks!

+7
linux linux-kernel cpu-usage opensuse
source share
1 answer

You get high sys activity because loading the data you make takes system calls that happen in the kernel. You may be able to solve the problems with slowness without updating the server. You can change the priority of planning. See the manual pages for enjoyable and insecure. See here and especially:

Niche values ​​range from -20 (highest priority, lowest attractiveness) and 19 (lowest priority, highest pleasantness).

$ ps -lp 941 FS UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 4 S 0 941 1 0 70 -10 - 1713 poll_s? 00:00:00 sshd

$ nice -n 19./test.sh My value is 19

$ renice -n 10 -p 941 941 (process ID) old priority -10, new priority 10

+1
source share

All Articles