About Me
Hello, I am Chao Zhang (aka Alex Zhang), Now I’m working at Yuozan Inc as a Middleware Development Engineer. My Email is zchao1995@gmail.com and github ID is tokers. Why “tokers”? Because the name “Alex” in github is a “critical resource”, and “tokers” is the nickname that I created (random? maybe) since I was in college and played the ACM/ICPC competitions.
My tech stack is somewhat “hybrid”. I use Nginx, OpenResty, OpenSSL, Golang, Kubernetes, Redis and so forth.
I’m an OpenResty contributor. Moreover, I’m passionate with those techs.
This site is used as my tech blog, interesting things will be archived.
My Career
- Youzan Inc - Middleware Development Engineer (2019.6 - present)
- UPYUN Inc - System Development Engineer (2016.7 - 2019.6)
My Own Projects
These Nginx C modules are used for taking the power of ZStandard to Nginx.
There are two modules here, one is “static”, for serving the existing .zstd file on the disk. And the other one, is used to compress data with the sreaming way.
This Nginx C module provides the basic file operations APIs with a mechanism that never block Nginx’s event loop. For now, it leverages Nginx’s thread pool, I/O operations might be offloaded to one of the free threads, and current Lua coroutine (Light Thread) will be yield until the I/O operations is done, in the meantime, Nginx in turn processes other events.
It’s worth to mention that the cost time of a single I/O operation won’t be reduced, it was just transferred from the main thread (the one executes the event loop) to another exclusive thread. Indeed, the overhead might be a little higher, because of the extra tasks transferring, lock waiting, Lua coroutine resumption (and can only be resumed in the next event loop) and so forth. Nevertheless, after the offloading, the main thread doesn’t block due to the I/O operation, and this is the fundamental advantage compared with the native Lua I/O library.
The APIs are similar with the Lua I/O library, but with the totally different internal implementations, it doesn’t use the stream file facilities in libc (but keep trying to be consistent with it), the buffer is maintained inside this module, and follows Cosocket’s internals.
Yet Another HTTP library for OpenResty! This HTTP library is for human beings, just like Python Request, APIs are trivil but wonderful.
It provides many features:
- HTTP/1.0, HTTP/1.1 and HTTP/2 (WIP).
- SSL/TLS support.
- Chunked data support.
- Convenient interfaces to support features like json, authorization and etc.
- Stream interfaces to read request body.
- HTTP/HTTPS proxy.
- Latency metrics.
- Session support.
I’m still working on this project and will improve it continuously.
The HTTP/2 Protocol (Client Side) Implementation for OpenResty.
This pure Lua library implements the client side HTTP/2 protocol, but not all the details are covered, for example, the stream dependencies is maintained but never used.
There are some inherent limitations which are not solved, however. For more details, you can just read the README.
- Hmmm, I will replenish this list in the future. :)