I made a very simple web crawler that writes output to the terminal (stdout), so I generally know how fast it's running. After I detach from tmux and check the MySQL table, it seems the script is running slower. (I should just open a second terminal and compare the speed before/after tmux has detached.)

Anyway, this has me wondering if the detached tmux session is too "nice". If I look in top I don't really know what I'm looking for. I see tmux, but is that really the detached session? How would I change the "niceness" of the detached tmux session? Would I do that through the operating system or through tmux?

  • I haven't finished tinkering but maybe the perceived slowness was just the MySQL query cache.
    – PJ Brunet
    Jun 1, 2015 at 2:35

2 Answers 2


Answering the question you asked: to change the niceness of an existing process, call renice. That's per process¹, not per session, so the tmux process is not directly relevant. Find the process ID of the crawler (e.g. with ps x on Linux, or with pstree) and call renice on it.

However this won't help you because you made two incorrect assumptions:

  • That detaching a tmux session renices the process — it doesn't.
  • That nicing a web crawler would influence its speed — that's highly unlikely, the limiting factor is almost always the network.

The most likely reason why the crawler slows down after a while is that the website is throttling your IP address because it made too many requests for its tastes. There's nothing you can do about this (except maybe try to space out your requests a little more from the start, hoping that the site will throttle you less).

¹ Or process group but that's not likely to be useful here.

  • My favorite part of your answer: "That detaching a tmux session renices the process — it doesn't."
    – PJ Brunet
    May 30, 2015 at 23:40

You need to change the priority of the web crawler. No, it's unlikely to be the tmux. Probably, tmux will have a child bash whose child will be the program.

I would usually look up the pid from the program name, but otherwise, running pstree -p should allow you to hierarchically find it without knowing its name.

You can renice the processt with renice(1), eg:

renice 5 1234

or. more verbosely,

renice -n 5 -p 1234

would renice process 1234 to priority 5

It is also possible to do that from within top, just press r and answer the two prompts asking for the pid and the new nice value.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .