Running strace command

I want to run the strace -p xxxx -o in a script to monitor a process that hangs sometimes and requires a restart, my question is if strace is constantly running in the background will it chew up system resources and cause the system slowness?

Run it and monitor the resources it consumes...I would not use trace as my first choice. I recommend using a tool like dbx to see what the process is doing or not doing. What o/s are you using? There are a number of other performance tools. I suppose the general choices of these tools is the monitor (like strace) or to look at the process state during hang. What analysis have you done when the process was hung?

How busy it is depends on what it's tracing. If it makes lots of system calls, it makes strace do more work. It's more liable to slow down whatever it's tracing than your system in general. strace may generate enormous logfiles if left to run unattended.

I am running Ubuntu 12.04.3 LTS

when the users try to access the application to login they receive this message:

Service Temporarily Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

when I login to the server i grep for the process and see that it is running but when i try to start it, it does not restart unless i issue kill -9 on the pid then restart it and it is successful. I don't know when the application gets hung but i want to run strace on the pid so if it does hang a script will kill the pid and restart the application.