Nginx Internals Talk in Guangzhou, China

nginx map

nginx map (click to view large image)

I’m going to give a free talk on nginx’s internals next month (September 19), in Guangzhou, China.

I’ve been reading the source code of nginx for a few days. Digging into this charming code is really a pleasant experience, though at first glance it appeared a little bit difficult to understand. Nginx becomes more and more popular, but unfortunately there is not enough documentation on its architecture and implementation. Now that I have spent a considerable amount of time reading the source code and have gained some knowledge, why not share it with those who want to know things under the hood?

So, if you are interested in this talk and you can be in Guangzhou that day, feel free to join in. Please comment on this post or drop me an email to let me know which parts you are interested in (see the mind map above, draft version though).

There might be a thousand Hamlets in a thousand people’s eyes. Note that I’m not Igor, and the only way I try to understand the nuts and bolts is by reverse engineering it, hence I can’t guarantee you no mistakes or misunderstandings in my talk. And frankly, it is not a trivial topic after all, not only because of the size of nginx’s code base, but also its elaborate design.

The speech will be in Chinese while slides will be in English. Specifics of time and location are coming soon. Stay tuned.

Update:
Time: 14:30-17:30, September 19, 2009
Location: Netease Building Tower E, Guangzhou Information Port #16 Keyun RD. Tianhe District, Guangzhou
Registration: http://blog.laiyonghao.com/2009/09/programming-tech-party/370

Comments (8)

Learn from Memcached’s Success

Memcached becomes more and more popular nowadays. It is widely used by many heavy loaded sites. Why does it succeed?

Well, of course the first and the most important reason is that it meets the need for speed of the web 2.0 sites, by caching data and objects in memory. However, from the point of view of a server developer, what I want to emphasize is that it is the simplicity of memcached’s protocol design makes it more successful. Take a look at memcached’s protocol:

  • storage: ("set", "add", "replace", "append", "prepend", "cas")
             <command name> <key> <flags> <exptime> <bytes> [noreply]rn
             cas <key> <flags> <exptime> <bytes> <cas unique> [noreply]rn
         reply: ("ERRORrn", "CLIENT_ERROR <error>rn", "SERVER_ERROR <error>rn",
             "STOREDrn", "NOT_FOUNDrn", "EXISTSrn", "NOT_FOUNDrn")
  • retrieval: ("get", "gets")
             get <key>rn
             gets <key>rn
         reply: ("ENDrn",
             "VALUE <key> <flags> <bytes> [<cas unique>]rn<data block>rn")
  • deletion:
             delete <key> [<time>] [noreply]rn
         reply: ("DELETEDrn", "NOT_FOUNDrn")
  • increment/decrement: ("incr", "decr")
             incr <key> <value> [noreply]rn
             decr <key> <value> [noreply]rn
         reply: ("NOT_FOUNDrn",
             "<value>rn")
  • statistics: ("stat")
             statsrn
             stats <args>rn
         reply: ("STAT <name> <value>rn",
             "STAT items:<slabclass>:<stat> <value>rn"
             "ENDrn")
  • other:
         flush_all
         reply: ("OKrn")
         versionrn
         reply: ("VERSION <version>rn")
         verbosity
         reply: ("OKrn")
         quit
  • With the textual protocol as shown above, memcache can be easily supported and implemented in various programming languages. No wonder dozens of different memcache clients appear. And then it consequently boosts memcached’s use. Simple thing usually will withstand the test of time. The old simple textual protocols, e.g., HTTP, FTP, SMTP and POP3 are still in use on the modern Internet. Not only because textual protocols can be easily parsed and extended, but also they are convenient for human being to read and debug. This is where the UNIX philosophy shines.

    In conclusion, always prefer textual protocol when designing your own application. It would turn out to be really a wise decision.

    Comments (5)

    Tips on High Performance Server Programming

    Yesterday, I gave a talk entitled “Tips on High Performance Server Programming” to some computer science graduate students at Jinan University. Below are the slides I used for the talk.

    Comments (6)