Find job id or application name from process id

I would like to understand list of applications with high CPU and memory consumption from the server.

I executed

sudo ps aux | grep rstudio-connect

to get process id and then using that process id ran this

sudo pstree -lpa $(processid)

but I am not getting job id or application.

Would like to understand how can I retrieve job id or application name from process id?

I am not sure what is the purpose but there is an R package to query processes on a machine

Maybe it could help?

Have you tried to get this information from the RStudio Connect admin dashboard?

As an admin user you can navigate to /Admin/Metrics in the Connect UI to view metrics:

image

Towards the bottom of the page you can view the active Connect processes, and get the PID, Content Name, CPU, etc.

Thanks for responding. I am already using Rstudio admin dashboard but wanted to check from backednd as well.

Once you have a PID, you can look inside /proc/ to get information around where it is executed.

One place with this info looks to be inside cat /proc/PID/environ, which shows the PWD (i.e. PWD=/mnt/rstudio-connect/apps/1011/3183 - in this case 1011 is the app id). There may be other places that are easier to parse, and obviously any of this could change based on Connect's internal process implementation changing. We will definitely log this request as product feedback for an easier way to introspect processes from the linux side.

1 Like