Comments (8)
@zavada What nginx variable are you using for the "request time" field in your access log? Is it $request_time
? If yes, then the time specified by the $request_time
variable includes the network I/O time between the client and your web server, which can be relatively large for slow downstream networks.
from lua-resty-redis.
@agentzh Yes, I use $request_time
.
But if I comment the line
local categories, err = red:smembers("categories:"..clear_url)
I don't have in the result this >100ms time requests. Thats why I think that problem is not in network I/O time between the client and my web server.
Maybe do you have other idea?
from lua-resty-redis.
@zavada Then you'll have to use tools like systemtap and dtrace to grab more details from those slow request samples in various places: nginx processes, kernel network stack, and the redis-server process. See my sample tools based on systemtap in the nginx-systemtap-toolkit and stapxx projects on GitHub for some ideas.
from lua-resty-redis.
@zavada Also, $request_time
may have some error due to the time caching mechanism in the nginx core. Use the ngx-lua-tcp-recv-time
tool in my stapxx project to measure the upstream cosocket recv latency time accurately at real time:
https://github.com/openresty/stapxx#ngx-lua-tcp-recv-time
from lua-resty-redis.
@zavada Furthermore, watch the CPU usage of your nginx worker processes, if their CPU usage can hit 100% from time to time, then you might just run out of CPU time and such intermittent long latency is totally reasonable. Similarly, you should watch the CPU usage of your redis-server process as well.
If any process is exhausting the CPU time, then you should use the various flame graph sampling tools to analyze the bottleneck:
https://github.com/openresty/nginx-systemtap-toolkit#sample-bt
https://github.com/openresty/stapxx#lj-lua-stacks
Regards,
-agentzh
from lua-resty-redis.
@zavada Sometimes, nginx may just block on some blocking I/O system calls (like file I/O) or semaphores used as some internal locks in nginx. Such blocking things can contribute to your cosocket latency as well. You can just the epoll-loop-blocking-distr tool to verify this:
https://github.com/openresty/stapxx#epoll-loop-blocking-distr
and further use the off-CPU time flame graph tool to analyze the causes:
https://github.com/openresty/nginx-systemtap-toolkit#sample-bt-off-cpu
from lua-resty-redis.
@agentzh When I try to run your examples I have next error
Checking "/lib/modules/2.6.32-431.el6.x86_64/build/.config" failed with error: No such file or directory
On my centos server I have "/lib/modules/2.6.32-431.el6.x86_64/build/" but don't ".config" inside. Do you know how I can fix it?
Thank you for your time and help.
from lua-resty-redis.
Hello!
On Sun, Oct 12, 2014 at 2:34 AM, zavada wrote:
@agentzh When I try to run your examples I have next error
Checking "/lib/modules/2.6.32-431.el6.x86_64/build/.config" failed with error: No such file or directory
On my centos server I have "/lib/modules/2.6.32-431.el6.x86_64/build/" but don't ".config" inside. Do you know how I can fix it?
Have you installed the "kernel-devel" and "kernel-debuginfo" packages
for your kernel actually being used?
See the following documentation for more details:
https://www.sourceware.org/systemtap/SystemTap_Beginners_Guide/using-systemtap.html#install-kinfo
Regards,
-agentzh
from lua-resty-redis.
Related Issues (20)
- How to connect redisDB with user id and password? HOT 1
- Confusing instructions for installation on README.md
- redis:connect is taking exactly 60 seconds for connection
- SSL not working
- The performance of redis pipeline mode is unstable HOT 3
- CLIENT SETNAME?
- redis:get(key) question HOT 2
- opm package outdated HOT 1
- Connection pool not creating HOT 2
- How to create a single redis connection HOT 5
- this support two-way authentication?
- Add keepalive for redis client to make the connections reliable
- Nginx 1.24 HOT 2
- Nginx creates more connection than poolsize, backlog to redis HOT 5
- lua tcp socket read timed out, context: ssl_certificate_by_lua*, client: 172.69.58.204, server: 0.0.0.0:443 HOT 2
- redis set_keepalive doesn't work HOT 1
- lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/redis.lua:357: bad request HOT 1
- no request found HOT 1
- Add the host:port to the error message
- Reading from client: error:0A000126:SSL routines::unexpected eof while reading
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-resty-redis.