Hi,
I've started using Grizzly 1.7.0 and it works very well.
I would like to get the number of current tcp connections for
statistics (http keep-alive connections). It seems like
SelectorThread.getKeepAliveStats().getCountConnections() returns the
total number of connections made (over the full lifetime) and not the
current number of open connections.
Can I obtain the number of current tcp connection from the http
module, or from lower-level parts of Grizzly?
When I log the numbers each second, I get:
KAS: conns=10, flushes=0, hits=20, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=11, flushes=0, hits=22, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=16, flushes=0, hits=36, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=17, flushes=0, hits=38, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=19, flushes=0, hits=42, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=20, flushes=0, hits=44, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=21, flushes=0, hits=46, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=23, flushes=0, hits=52, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=24, flushes=0, hits=60, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=25, flushes=0, hits=62, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=26, flushes=0, hits=64, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=27, flushes=0, hits=66, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=28, flushes=0, hits=68, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=29, flushes=0, hits=70, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=30, flushes=0, hits=72, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=31, flushes=0, hits=74, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=32, flushes=0, hits=76, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KAS: conns=33, flushes=0, hits=78, refusals=0, timeouts=0,
maxConns=8196, secTimeouts=30
KeepAliveStats kas = getKeepAliveStats();
return "KAS: conns=" + kas.getCountConnections()
+ ", flushes=" + kas.getCountFlushes()
+ ", hits=" + kas.getCountHits()
+ ", refusals=" + kas.getCountRefusals()
+ ", timeouts=" + kas.getCountTimeouts()
+ ", maxConns=" + kas.getMaxConnections()
+ ", secTimeouts=" + kas.getSecondsTimeouts() + "\n";
Grizzly configuration for port 80
maxThreads: 50
minThreads: 5
ByteBuffer size: 32768
useDirectByteBuffer: false
useByteBufferView: false
maxHttpHeaderSize: 8192
maxKeepAliveRequests: 8196
keepAliveTimeoutInSeconds: 30
Static File Cache enabled: false
Stream Algorithm : com.sun.grizzly.http.algorithms.NoParsingAlgorithm
Pipeline : com.sun.grizzly.http.LinkedListPipeline
Round Robin Selector Algorithm enabled: false
Round Robin Selector pool size: 0
recycleTasks: true
Asynchronous Request Processing enabled: false
----
- Peter Speck