Yichun Zhang

Results 937 comments of Yichun Zhang

@ryannining luasql is blocking. Always avoid it. You can get performance boost in lua-resty-mysql by enabling the experimental trace stitching feature in LuaJIT. Just put the following lines in your...

@ryannining BTW, ensure you're running the latest OpenResty bundle. As I've repeated earlier, do profiling with flame graph tools and it'll be much easier to optimize things :)

@ryannining Your http://lampu.tokoled.net:81/ site looks interesting. Glad you're migrating from PHP to OpenResty :) Hopefully you can have more fun with it. BTW, you're encouraged to join the openresty-en mailing...

@ryannining How exactly do you implement the `raw` function? Your own abstraction in the sample code makes me clueless :)

@ryannining My hunch is that your `raw` function is implemented in an absolutely wrong way like using the following way to do buffering, which is terribly slow in Lua: ```...

@ryannining Because we're talking about performance here, I'd list the following issues in your latest version of `raw`: 1. avoid calling ngx.ctx over and over again. It's a Lua metamethod...

@ryannining Just define a custom Lua module like `resty.mysql` you're using. Basically: ``` lua -- utils.lua local _M = {} function _M.raw() ... end return _M ``` And then later...

@ryannining Nope. In case of disabling the Lua code cache, every request has its own (fresh) Lua VM instance. No Lua-level data sharing across requests is possible.

@splitice Just a side note: I think the `ngx.semaphore` API can be ported over to the stream subsystem in a similar way :)

@splitice Will you add a test file for using `ngx.balancer` in the stream subsystem here? (By porting the existing `t/balancer.t` file to t/balancer-stream.t, for example.)