OpenVZ Forum


Home » General » Support » Slow vz start/stop
Re: Slow vz start/stop [message #9521 is a reply to message #9506] Mon, 08 January 2007 18:59 Go to previous messageGo to previous 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.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: kernel path?
Next Topic: vzpkgcache on 64 bit os?
Goto Forum:
  


Current Time: Mon Sep 22 14:02:12 GMT 2025

Total time taken to generate the page: 0.07266 seconds