OpenVZ Forum


Home » General » Support » Slow vz start/stop
Slow vz start/stop [message #9505] Mon, 08 January 2007 10:26 Go to next message
dagr is currently offline  dagr
Messages: 83
Registered: February 2006
Member
I have about 60 VPSs , and when i do /etc/init.d/vz stop/start - it s a pain for me. Its so slow ,130s for stop and 120 for start . Ordinary VPS start takes 2s (3s with dropped quota) and stop - 7. I checked this script , and noticed that it stops parallely 4 VPS by default, so the question is - is it ok to stop them all paralelly at once ? And is there any problem to make start parallel as well ?
Re: Slow vz start/stop [message #9506 is a reply to message #9505] Mon, 08 January 2007 10:39 Go to previous messageGo to next message
dagr is currently offline  dagr
Messages: 83
Registered: February 2006
Member
i tried speed up stop, in addition i removed unnecessary as i believe "sleep 1" after every "vzctl stop" (as it wait pids anyway) so now it stops in 22s
Re: Slow vz start/stop [message #9521 is a reply to message #9506] Mon, 08 January 2007 18:59 Go to previous messageGo to next message
dagr is currently offline  dagr
Messages: 83
Registered: February 2006
Member
Speeding up start was more difficult - as it waits for result and shows its start OK for every VPS.
Now its 20s against 120s before.
Here is changed part of /etc/init.d/vz
        for veid in $velist; do                 
                [ "${veid}" = "0" ] && continue 
#               __echo "Starting VE ${veid}: "  

 if [ "x${VZFASTBOOT}" = "xyes" -a "x${DISK_QUOTA}" = "xyes" ];  
 then                                                            
         $VZQUOTA stat ${veid} >/dev/null 2>&1                   
         if [ $? -eq 6 ]; then                                   
                 if $VZQUOTA show ${veid} 2>&1 | grep "vzquota : .....................
                         $VZQUOTA on ${veid} --nocheck >/dev/null
                         need_restart="${need_restart} ${veid}"  
                 fi                                              
         fi                                                      

#               msg=`$VZCTL start ${veid} 2>&1`                                
                                                                               
                                                                               
                                                                               
                /home/openvz/scripts/vzstart ${veid} >/tmp/vzstart_${veid}.log 
                usleep 200000                                                 
                                                                               
                                                                               
                                                                               
                                                                               
#               if [ $? -eq 0 ]; then                                          
#                       print_success                                          
#               else                                                           
#                       print_failure "$msg"                                   
#               fi                                                             
        done                                                                   
                                                                               
        sleep 4                                                                

        for veid in $velist; do                                  
         __echo "Starting VE ${veid}: "                          
         msg="`cat /tmp/vzstart_${veid}.log`"                    
                if [ ! -z "`echo \"$msg\"| grep SUCCESS`" ]; then
                        print_success                            
                else                                             
                                                                 
                        print_failure "$msg"                     
                fi                                               
                                                                 
        done                                                     

        for veid in ${need_restart}; do        
                __echo "Stopping VE ${veid}: " 

.................



/home/openvz/scripts/vzstart is
#!/bin/sh           
                    
sudo vzctl start $1 
if [ $? -eq 0 ];then
echo SUCCESS        






Had to write auxilluary script for tracking this status.
Also found out that need some interval between VPSs start anyway, cause simultaneous mounts give error for me(may be its only for loopback device mount ). Should make interval 0.2 s, less is not good + sleep 4 (must be more then single vps start duration) after starting to make sure all starts finished with log files and its ok to read status.
Actually it starts even faster then 20s - because "sleep 4" necessary only because of VPSs which launched last and because print_success function has its own sleep.
Re: Slow vz start/stop [message #9538 is a reply to message #9506] Tue, 09 January 2007 09:09 Go to previous messageGo to next message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
Hello,

Thanks for the report. I filled the bug about "sleep 1|
http://bugzilla.openvz.org/show_bug.cgi?id=431
so it will be fixed soon.

As concerns ${PARALLEL}... this is not good to fix the value...
but stop all VEs at once isn't good too...
So the question is open, please, leave your comments at bugzilla.

Vasily.
Re: Slow vz start/stop [message #9542 is a reply to message #9521] Tue, 09 January 2007 09:21 Go to previous messageGo to next message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
Probably this is a good idea to parallelize VEs start, but in a bit
other way. Please, go to the bug #431 and discuss it where.

Thanks,
Vasily.
Re: Slow vz start/stop [message #9548 is a reply to message #9542] Tue, 09 January 2007 11:22 Go to previous message
dagr is currently offline  dagr
Messages: 83
Registered: February 2006
Member
will do - if any prob
Previous Topic: kernel path?
Next Topic: vzpkgcache on 64 bit os?
Goto Forum:
  


Current Time: Sat Nov 16 10:40:01 GMT 2024

Total time taken to generate the page: 0.03181 seconds