RFC: Feasibility of a "dynamic module loader" built in to nginx?

Maxim Dounin mdounin at mdounin.ru
Tue Apr 15 12:15:12 UTC 2014


Hello!

On Tue, Apr 15, 2014 at 03:52:04AM -0400, trapni wrote:

> Hey, I just found you via Google as I was trying to find out why ..... Nginx
> is not supporting dynamic loading of modules, for the very obvious issues
> the other posters seem to have too.
> 
> However, Maxim, you claim, that one reason is performance. While performance
> of course matters, I'd like to know why you say so.
> Can you please go a little bit more into the technical details why a dynamic
> loaded module does not perform as well as a statically linked "module"?
> 
> Of course, a compiler could use global optimization techniques to perform
> interprocedual optimizations, but I don't believe (yet), that the impact
> shall be that high.
> 2nd) statically linked libraries speed up process bootup, but this is
> neglect-able for a long-running process.
> 3rd) of course, at least for the core modules, they could use #ifdef's
> inside the request structs and friends (just as you stated) in order to
> further optimize resource (ie. memory) usage. 
> 
> So, I'm only interested in the performance arguments (not zero-downtime
> upgrade,...), so I can understand a little better.

In addition to the above, calling functions from dynamically 
linked libraries implies additional indirection, hence it's 
expected to be slower.

I don't think that speed difference is a major problem though, 
most likely it will be small.  It's just one of the reasons in the 
list.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list