这是我如何使用它 -
private static final PoolingHttpClientConnectionManager connPool;
static {
connPool = new PoolingHttpClientConnectionManager();
// Increase max total connection to 200
connPool.setMaxTotal(200);//configurable through app.properties
// Increase default max connection per route to 50
connPool.setDefaultMaxPerRoute(20);//configurable through app.properties
}
CloseableHttpClient httpClient = HttpClients.custom()
.setConnectionManager(connPool) .build();
Run Code Online (Sandbox Code Playgroud)
另外我在http GET周围放了一个finally块 -
finally {
try {
httpClient.close();
} catch (IOException e) {
LOGGER.error(e.getMessage());
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的堆栈跟踪 -
java.lang.IllegalStateException: Connection pool shut down
at org.apache.http.util.Asserts.check(Asserts.java:34)
at org.apache.http.pool.AbstractConnPool.lease(AbstractConnPool.java:169)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.requestConnection(PoolingHttpClientConnectionManager.java:217)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:157)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:194)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:85)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
at …Run Code Online (Sandbox Code Playgroud) 我是nginx的新手.我在用 -
health_check uri=/some/uri
Run Code Online (Sandbox Code Playgroud)
但在使用此命令运行测试时 -
sudo /usr/sbin/nginx -t -c /etc/nginx/nginx.conf
Run Code Online (Sandbox Code Playgroud)
我收到以下错误 -
nginx: [emerg] unknown directive "health_check" in /etc/nginx/sites-enabled/abc.conf:121
Run Code Online (Sandbox Code Playgroud)
有人能说出这里有什么问题吗?我用apache2来做所有的jing-bang,但我对nginx知之甚少.
在cs.stackexchange上问这个..得到了一个downvote ..因为我不是很清楚..所以我会尝试在这里更具体..
问:设计一个数据结构,以便在最后1分钟内返回到Web服务器的连接数.
假设 -
我在寻找:
效率 - 是否可以在O(1)中执行此操作?例如,如果我们在O(n)中这样做..问题是如果计算答案需要N毫秒......还有一些连接已经在N ms中排队了.我应该如何解决这个问题.或者我只能忽略小延迟而O(n)是一个好的表现
推理/方法 - 我们在生产中的无数部署中是否做了类似的事情?有类似的问题..?
这是"大数据"吗?用于存储连接的数据是否是大数据问题的最后N(N是10阶)分钟?
我的努力:我知道 -
方法 -
我还运行一个守护程序,删除超过10分钟的条目/文件..所以我不存储不需要的数据