2012/01/05

Nginx - overview - 2



The source folder constructs as:

core -- the core data structures and functions.

event -- event-related data structure etc.

http -- http protocol specific data structures etc.

mail -- since ng also acts as mail server.

misc -- some miscellaneous files.

os -- ng supports multiple os(s), os specific files.

I suppose that Igor is an organized guy in code, since when you compile ng project, no compile warning is outputed. You may be aware that Igor turned on gcc flags: -Wall -Wno-unused-parameter -Wunused-function, -Wunused-variable, -Wunused-value.

I mainly focus on core, event, and http, others might be omitted.

In core folder, many basic data structures are implemented without importing third party library. I wonder why Igor bother to do this. After one month reading, I figured it out: the efficiency concern. Importing extra third party means giving your efficiency control to other unknown guys. Put yourself in third party developers' shoes, at some design trade-off, you could achieve better generic goal by scarifying some time efficiency and memory space. Ooooh, no, wait a minute, that's exactly not what we want. To support high concurrency, we must try very hard to be fast and occupy less memory. Then, you get the point.

To address the structure or design clear, I will posts some picture or flow chart if necessary. Draw tool is avaiable here(http://www.graphviz.org/).

No comments:

Post a Comment