Score:0

Is there a performance impact to reloading nginx configuration?

sn flag
a p

I've got an nginx server whose config is generated on the fly by a set of scripts, and managing whether there's a config-restart-requiring change or not is actually a nontrivial process.

Is there a downside to simply telling nginx to reload via HUP once every few minutes (every minute?) to guarantee that the new config - which will overwrite the old in the same location - is brought in?

My initial testing on a single host with ~100tps load generated shows essentially no difference, but I'm concerned about production loads and what this might mean if eg. every CPU core is 'in use' by an nginx thread already when the config is reloaded.

The docs help not at all, so I ask: is there a performance impact to reloading nginx config via SIGHUP?

anx avatar
fr flag
anx
One strategy to trigger actions on file changes is called *inotify* and systemd has reasonable features to utilize that to trigger a service reload (see *path* units).
sn flag
a p
@anx I don't care about every change, only some - that's why it's hard to differentiate. What's the impact of a request timeout? What makes a request timeout 'hard'?
anx avatar
fr flag
anx
Are you applying an *unconditional* (even for actively used connections) timeout anyway? Then `worker_shutdown_timeout` does little harm while helping you establish an upper bound for the non-zero cost of keeping old processes around after your reload spins up new ones. If you serve long-running connections and lots of those, testing that might paint a different picture than your presumably short-connection "tps" test.
sn flag
a p
Oh, I see what you're saying - no, most of our connections aren't that long lived. I'll run another test to see behavior given something like our P99 connection time.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.