Yichun Zhang

Results 937 comments of Yichun Zhang

Seems like you misunderstand rate limiting. Your shell command simply issues requests serially and as fast as possible. The number of rejected requests have no direct relationship with your burst...

No, your understanding of req rate is wrong. It is also required to fulfill the rate within a single second. The time unit is _irrelevant_ to the rate.

The rate defines the time interval constraint between every two successive requests. It is not calculated by the seconds at all.

rate=20 & burst=30 means that it will only reject requests exceeding the 50 r/s rate. I suggest you take a closer look at the leaky bucket algorithm used by both...

@kchsieh The access logs make little sense here since we check at the level of milliseconds while the timestamps in the access logs are only at the seconds precision.

@yanxurui It's better be a separate Lua library since I don't want lua-resty-memcached to depend on lua-resty-balancer.

@ryannining I'm guessing the slowness in your Lua code comes from your frequent calls `ngx.print` and `ngx.say` instead of `lua-resty-mysql`. Unlike PHP's `echo`, these two Lua output functions do not...

@ryannining As I've suggested earlier, try profiling with the C-land and Lua-land on-CPU flame graph tools. We can easily see the bottlenecks on your flame graphs :)

@ryannining Also, it might be helpful by benchmarking the raw Lua code using lua-resty-mysql instead, without using MoonScript.

@ryannining BTW, I've noticed that the second argument to your `queryi()` function in the MoonScript version does not match the number in your `limit` clause of the SQL query. Is...