Memory usage of dmd

Etienne via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 10 09:17:01 PST 2014


On 2014-11-10 12:02 PM, Xavier Bigand wrote:
> As I know to be able to have no down time with vibe we need to be able
> to build directly on the server where the program runs.
>
> Maybe I just need to wait that I have some users to pay a better server
> with more memory.

With a low number of users, there's no reason to worry about a 1 second 
downtime from closing the process and replacing the application file. 
You should use a bash script to keep the process open though:

# monitor.sh
nohup ./autostart.sh > stdout.log 2> crash.log >/dev/null &

# autostart.sh
while true ; do
   if ! pgrep -f '{processname}' > /dev/null ; then
     sh /home/{mysitefolder}/start.sh
   fi
   sleep 1
done

# start.sh
nohup ./{yourapplication} --uid={user} --gid={group} >> stdout.log 2>> 
crash.log >> stdout.log &

# install.sh
pkill -f '{processname}'
/bin/cp -rf {yourapplication} /home/{mysitefolder}/


Using a console, run monitor.sh and the autostart.sh script will 
re-launch your server through start.sh into a daemon. Verifications will 
be made every second to ensure your server is never down because of a 
badly placed assert.

If you need to replace your server application with an update, run the 
install.sh script from the folder where the update is.


More information about the Digitalmars-d-learn mailing list