# How to change the niceness value on nodered.service

**URL:** <https://discourse.nodered.org/t/how-to-change-the-niceness-value-on-nodered-service/53608>\
**Category:** General\
**Created:** [12 November 2021 03:09 UTC](https://discourse.nodered.org/t/how-to-change-the-niceness-value-on-nodered-service/53608 "2021-11-12T03:09:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![janedoe123](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@janedoe123](https://discourse.nodered.org/u/janedoe123)\
**Post date:** [12 November 2021 03:09 UTC](https://discourse.nodered.org/t/how-to-change-the-niceness-value-on-nodered-service/53608/1 "2021-11-12T03:09:09Z")

</div>

Hi all,

I want to give a higher priority to Node-RED process by setting the nice value to -20.

However, I can't seems to find the option in the nodered.service file as described [here](https://discourse.nodered.org/t/reference-optimising-node-red/38321) :

- **Change Node-RED's `nice` value**. Dave's installer for the Pi sets niceness at `10` which is lower than the average. Try setting to zero or even a negative number to boost the priority of the Node-RED process compared to others on the system. This may, of course, have a negative impact on other processes running on the same machine. This is changed in the systemd service file that runs Node-RED on bootup.

Below the extract of my nodered.service file:

```auto
Environment="NODE_OPTIONS=--max_old_space_size=2048"
# define an optional environment file in Node-RED's user directory to set custom variables externally
EnvironmentFile=-/home/An04Mal_B0SS-Us3R/.node-red/environment
# uncomment and edit next line if you need an http proxy
#Environment="HTTP_PROXY=my.httpproxy.server.address"
# uncomment the next line for a more verbose log output
#Environment="NODE_RED_OPTIONS=-v"
# uncomment next line if you need to wait for time sync before starting
#ExecStartPre=/bin/bash -c '/bin/journalctl -b -u systemd-timesyncd | /bin/grep -q "systemd-timesyncd.* Synchronized to time server"'

ExecStart=/usr/bin/env node-red-pi $NODE_OPTIONS $NODE_RED_OPTIONS
#ExecStart=/usr/bin/env node $NODE_OPTIONS red.js $NODE_RED_OPTIONS
# Use SIGINT to stop
KillSignal=SIGINT
# Auto restart on crash
Restart=on-failure
RestartSec=20
# Tag things in the log
SyslogIdentifier=Node-RED
#StandardOutput=syslog

[Install]
WantedBy=multi-user.target

```

I know manually adding `sudo nice -n -20` front of the ExecStart command works, as follows:  
`ExecStart=sudo nice -n -20 /usr/bin/env node-red-pi $NODE_OPTIONS $NODE_RED_OPTIONS`

But this also means that Node-RED is therefore running as root, and not as normal user...

Any workaround to make the nice value -20 but running as normal user ?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [12 November 2021 04:21 UTC](https://discourse.nodered.org/t/how-to-change-the-niceness-value-on-nodered-service/53608/2 "2021-11-12T04:21:21Z")

</div>

I would go to that thread you mentioned and ask there how to set the `nice` value.

It is said that you use `systemd` but that's above my knowledge set.

Please don't worry about asking _dumb_ questions. In reality the only **DUMB** question is the one you don't ask, as you suffer both times.  
1 for not knowing.  
2 for not asking.

Hope that helps.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 November 2021 09:26 UTC](https://discourse.nodered.org/t/how-to-change-the-niceness-value-on-nodered-service/53608/3 "2021-11-12T09:26:41Z")

</div>

See [linux - Set niceness value in a systemd user service - Super User](https://superuser.com/questions/1447351/set-niceness-value-in-a-systemd-user-service)

Why do want to do this? The nice value is rarely important.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [11 January 2022 09:27 UTC](https://discourse.nodered.org/t/how-to-change-the-niceness-value-on-nodered-service/53608/4 "2022-01-11T09:27:03Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
