Comments (5)
It seems like normal situation because the proxy_cache is enabled, probably next requests would be sent from cache after processed one request.
In that case, the next requests(cached) does not pass through proxy_pass.
So probably the count of server_name in the very front will be increased.
from nginx-module-vts.
You can check for yourself by comparing the log traffic statistics on pure Nginx and modulet and you will be surprised that no module written to the log data is correct and enabled module, you will see that the server sends a response 304 but he writes in the log is not the correct data transferred bytes
PS: Sorry for my English
from nginx-module-vts.
Please explain the situation in detail.(Your link is not an english)
The module nginx-module-vts does not touch anything related to the logging and others.
The situation may occur regardless of nginx-module-vts.(may normal situation in proxy_cache_path shared memory)
How about if you try this?
- disabled nginx-module-vts
- request(e.g. http://example.com/1.txt)
- request(e.g. http://example.com/1.txt)
- wait(proxy_cache_valid time:1m?)
- request(e.g. http://example.com/1.txt)
- nginx restart
- request(e.g. http://example.com/1.txt)
from nginx-module-vts.
OK, test
dd if=/dev/zero of=/tmp/index.html bs=1M count=1
config to example.com -> proxy -> backend
log_format bbs '$status | server_name:$server_name | body_bytes_sent:$body_bytes_sent | cache_status:$upstream_cache_status';
access_log logs/access.log bbs;
proxy_cache_path one levels=1:2 keys_zone=one:10m inactive=1d max_size=1G;
vhost_traffic_status_zone;
server {
listen 80 default_server;
server_name _;
location /status {
access_log off;
vhost_traffic_status off;
vhost_traffic_status_display;
vhost_traffic_status_display_format html;
}
}
upstream backend { server 127.0.0.1:8888; }
upstream proxy { server unix:/tmp/proxy.sock; }
server {
listen 8888;
server_name backend;
location / { root /tmp; }
}
server {
listen 80;
server_name example.com;
location / {
proxy_set_header Host backend;
proxy_pass http://proxy;
proxy_cache one;
proxy_cache_revalidate on;
proxy_cache_valid 200 10s;
}
}
server {
listen unix:/tmp/proxy.sock;
server_name proxy;
location / {
proxy_pass http://$host;
}
}
make 3 request
curl example.com > /dev/null
log (bbs)
200 | server_name:backend | body_bytes_sent:1048576 | cache_status:-
200 | server_name:example.com | body_bytes_sent:1048576 | cache_status:MISS
200 | server_name:proxy | body_bytes_sent:1048576 | cache_status:-
200 | server_name:example.com | body_bytes_sent:1048576 | cache_status:HIT
304 | server_name:backend | body_bytes_sent:0 | cache_status:-
200 | server_name:example.com | body_bytes_sent:1048576 | cache_status:REVALIDATED
304 | server_name:proxy | body_bytes_sent:0 | cache_status:-
in log all good, but if we look at what we show module, we see incorrect data
from nginx-module-vts.
The request(yours) is processed as follows:
-----------------------------------------
N phase code
-----------------------------------------
1 server[example.com] 200
2 upstream[proxy] 200
-----------------------------------------
3 server[proxy:/tmp/proxy.sock] 304
4 upstream[backend] 304
-----------------------------------------
5 server[backend] 304
-----------------------------------------
The module(vts) is processed as follows:
In step2 is using step1's result(status_code, in_bytes, out_bytes...)
In step4 is using step3's result(status_code, in_bytes, out_bytes...)
At this moment in time, the nginx-module-vts is using the server context's result for the upstream context's result.
from nginx-module-vts.
Related Issues (20)
- buffer size may be too small HOT 2
- Release a new version HOT 2
- No such file or directoryodule-vts/config: line 2: auto/have HOT 2
- Label metrics with jsonrpc method HOT 16
- the status of server is not current when max_fails = 0 HOT 4
- /status/format/json not served after clean installation HOT 1
- VTS doesn't support query string encoding HOT 1
- I encountered the following Syntax error while compiling the vts source code in windows environment HOT 2
- [emerg] 1#1: module "/etc/nginx/modules/ngx_http_vhost_traffic_status_module.so" version 1022001 instead of 1025002 in /etc/nginx/nginx.conf:5 HOT 1
- periodic cleanup of shared memory? HOT 2
- Evaluate using Profile-Guided Optimization (PGO) and Post-Link Optimization (PLO) on VTS HOT 3
- Question - time window of statistics HOT 1
- Module bug HOT 4
- Will the request fail? 'ngx_slab_alloc() failed: no memory in vhost_traffic_status_zone' HOT 1
- 2024 Can this tool support TCP monitor? HOT 1
- shm_add_upstream error HOT 1
- how to disable upstream statistics collection? HOT 4
- bug: absolute URL prevent the use of a reverse proxy with a different path in front of the stats HOT 4
- the status HTML does not display HOT 1
- nginx-module-vts version 0.1.8 in OpenResty 1.21.4.3 not display upstream data HOT 9
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 nginx-module-vts.