文档章节

Tomcat IO续

强子1985
 强子1985
发布于 2015/08/23 11:41
字数 1637
阅读 226
收藏 0
1.4.3.2 StringCache锁优化

在处理过程中,发现有这么一个锁

"catalina-exec-6" daemon prio=10 tid=0xb7629400 nid=0x86a waiting for monitor entry [0x908e1000]

   java.lang.Thread.State: BLOCKED (on object monitor)

       at org.apache.tomcat.util.buf.StringCache.toString(StringCache.java:221)

       - waiting to lock <0x9c8adaf0> (a java.util.HashMap)

       at org.apache.tomcat.util.buf.ByteChunk.toString(ByteChunk.java:528)

       at org.apache.tomcat.util.buf.MessageBytes.toString(MessageBytes.java:196)

       at org.apache.catalina.connector.Request.getRequestURI(Request.java:2227)

       at org.apache.catalina.valves.AccessLogValve$RequestElement.addElement(AccessLogValve.java:1590)

       at org.apache.catalina.valves.AccessLogValve.log(AccessLogValve.java:962)

       at org.apache.catalina.core.AccessLogAdapter.log(AccessLogAdapter.java:51)

       at org.apache.catalina.core.ContainerBase.logAccess(ContainerBase.java:1263)

       at org.apache.catalina.core.ContainerBase.logAccess(ContainerBase.java:1270)

       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:441)

       at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)

       at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)

       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1879)

       - locked <0x9d178110> (a org.apache.tomcat.util.net.NioChannel)

       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)

       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

       at java.lang.Thread.run(Thread.java:701)

 

"catalina-exec-5" daemon prio=10 tid=0x91818800 nid=0x869 waiting for monitor entry [0x90932000]

   java.lang.Thread.State: BLOCKED (on object monitor)

       at org.apache.tomcat.util.buf.StringCache.toString(StringCache.java:221)

       - waiting to lock <0x9c8adaf0> (a java.util.HashMap)

       at org.apache.tomcat.util.buf.ByteChunk.toString(ByteChunk.java:528)

       at org.apache.tomcat.util.buf.MessageBytes.toString(MessageBytes.java:196)

       at org.apache.catalina.connector.Request.getRequestURI(Request.java:2227)

       at org.apache.catalina.valves.AccessLogValve$RequestElement.addElement(AccessLogValve.java:1590)

       at org.apache.catalina.valves.AccessLogValve.log(AccessLogValve.java:962)

       at org.apache.catalina.core.AccessLogAdapter.log(AccessLogAdapter.java:51)

       at org.apache.catalina.core.ContainerBase.logAccess(ContainerBase.java:1263)

       at org.apache.catalina.core.ContainerBase.logAccess(ContainerBase.java:1270)

       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:441)

       at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)

       at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)

       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1879)

       - locked <0x9cdabb90> (a org.apache.tomcat.util.net.NioChannel)

       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)

       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

       at java.lang.Thread.run(Thread.java:701)

 

 

 

 

"catalina-exec-2" daemon prio=10 tid=0x099ea000 nid=0x866 runnable [0x9129a000]

   java.lang.Thread.State: RUNNABLE

       at java.lang.String.equals(String.java:1025)

       at org.apache.tomcat.util.buf.StringCache$ByteEntry.equals(StringCache.java:657)

       at java.util.HashMap.get(HashMap.java:322)

       at org.apache.tomcat.util.buf.StringCache.toString(StringCache.java:293)

       - locked <0x9c8adaf0> (a java.util.HashMap)

       at org.apache.tomcat.util.buf.ByteChunk.toString(ByteChunk.java:528)

       at org.apache.tomcat.util.buf.MessageBytes.toString(MessageBytes.java:196)

       at org.apache.catalina.connector.Request.getRequestURI(Request.java:2227)

       at org.apache.catalina.valves.AccessLogValve$RequestElement.addElement(AccessLogValve.java:1590)

       at org.apache.catalina.valves.AccessLogValve.log(AccessLogValve.java:962)

       at org.apache.catalina.core.AccessLogAdapter.log(AccessLogAdapter.java:51)

       at org.apache.catalina.core.ContainerBase.logAccess(ContainerBase.java:1263)

       at org.apache.catalina.core.ContainerBase.logAccess(ContainerBase.java:1270)

       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:441)

       at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)

       at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)

       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1879)

       - locked <0x9d0e9a10> (a org.apache.tomcat.util.net.NioChannel)

       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)

       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

       at java.lang.Thread.run(Thread.java:701)

 

"catalina-exec-1" daemon prio=10 tid=0x9180fc00 nid=0x865 waiting for monitor entry [0x910ab000]

   java.lang.Thread.State: BLOCKED (on object monitor)

       at org.apache.tomcat.util.buf.StringCache.toString(StringCache.java:221)

       - waiting to lock <0x9c8adaf0> (a java.util.HashMap)

       at org.apache.tomcat.util.buf.ByteChunk.toString(ByteChunk.java:528)

       at org.apache.tomcat.util.buf.MessageBytes.toString(MessageBytes.java:196)

       at org.apache.catalina.connector.Request.getRequestURI(Request.java:2227)

       at org.apache.catalina.valves.AccessLogValve$RequestElement.addElement(AccessLogValve.java:1590)

       at org.apache.catalina.valves.AccessLogValve.log(AccessLogValve.java:962)

       at org.apache.catalina.core.AccessLogAdapter.log(AccessLogAdapter.java:51)

       at org.apache.catalina.core.ContainerBase.logAccess(ContainerBase.java:1263)

       at org.apache.catalina.core.ContainerBase.logAccess(ContainerBase.java:1270)

       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:441)

       at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)

       at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)

       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1879)

       - locked <0x9ce8d5c0> (a org.apache.tomcat.util.net.NioChannel)

       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)

       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

       at java.lang.Thread.run(Thread.java:701)

 

这里是为了记录access日志

修改方法:

修改org.apache.tomcat.util.buf.ByteChunk

    // -------------------- Conversion and getters --------------------

 

    @Override

    public String toString() {

        if (null == buff) {

            return null;

        } else if (end-start == 0) {

            return "";

        }

        return StringCache.toString(this);

    }

修改为

    // -------------------- Conversion and getters --------------------

 

  @Override

    public String toString() {

        if (null == buff) {

            return null;

        } else if (end-start == 0) {

            return "";

        }

        //return StringCache.toString(this);

        StringCache.accessCount++;

        return this.toStringInternal();

    }

这里忽略了StringCacheaccessCounthitCount两个统计字段。

 

1.4.3.3 servlet

在调试时,发现有个锁

"catalina-exec-159" daemon prio=10 tid=0x91842c00 nid=0xd30 waiting for monitor entry [0x90473000]

   java.lang.Thread.State: BLOCKED (on object monitor)

   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:353)

   - waiting to lock <0x9d027848> (a org.apache.jasper.servlet.JspServletWrapper)

   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)

   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)

   at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)

   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)

   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)

   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)

   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)

   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)

   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)

   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)

   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1879)

   - locked <0x9db454c0> (a org.apache.tomcat.util.net.NioChannel)

   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)

   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

   at java.lang.Thread.run(Thread.java:701)

查看源码找到位置所在:

            /*

             * (1) Compile

             */

            if (options.getDevelopment() || firstTime ) {

                synchronized (this) {

                    firstTime = false;

 

                    // The following sets reload to true, if necessary

                    ctxt.compile();

                }

            } else {

                if (compileException != null) {

                    // Throw cached compilation exception

                    throw compileException;

                }

            }

说明如果是开发模式或者第一次加载时,都需要执行此同步块。

通过打印日志

 

 

可以看到,基本上除了因为第一次加载外,其它全部是因为处于开发模式而导致重新进入此模块。

那么如何让Tomcat运行在非Develop模式?

org.apache.jasper.EmbeddedServletOptions565行。

 

 

 

看来可以在配置文件中配置。

在对应的servelt的配置项中

        <init-param>

            <param-name>development</param-name>

            <param-value>false</param-value>

        </init-param>

修改后的效果如下:

 

也可以直接修改代码,将development字段的默认值设置为false.

 

1.4.3.4 AccessLog
 

 

AccessLogValve.java1144行。代码为

synchronized (this) {

                if (writer != null) {

                    writer.println(message);

                    if (!buffered) {

                        writer.flush();

                    }

                }

            }

如果不需要access log记录,则可以屏蔽掉这段代码。

这个根据实际的需要决定。

 

1.4.4 日志锁优化

通过查看线程栈jstack,可以看到

 

 

 

"catalina-exec-6" daemon prio=10 tid=0x90705400 nid=0x4ab waiting for monitor entry [0x906ad000]

   java.lang.Thread.State: BLOCKED (on object monitor)

       at java.io.PrintWriter.write(PrintWriter.java:427)

       - waiting to lock <0x9c551ec8> (a java.io.OutputStreamWriter)

       at java.io.PrintWriter.write(PrintWriter.java:446)

       at org.apache.juli.FileHandler.publish(FileHandler.java:208)

       at java.util.logging.Logger.log(Logger.java:573)

       at java.util.logging.Logger.doLog(Logger.java:598)

       at java.util.logging.Logger.logp(Logger.java:714)

       at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:183)

       at org.apache.juli.logging.DirectJDKLog.error(DirectJDKLog.java:146)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.addEvent(NioEndpoint.java:1043)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1081)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1072)

       at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.release(Http11NioProtocol.java:221)

       at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:616)

       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1876)

       - locked <0x9cdf2ed8> (a org.apache.tomcat.util.net.NioChannel)

       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)

       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

       at java.lang.Thread.run(Thread.java:701)

 

"catalina-exec-5" daemon prio=10 tid=0x9172ec00 nid=0x4aa runnable [0x906fe000]

   java.lang.Thread.State: RUNNABLE

       at java.io.FileOutputStream.writeBytes(Native Method)

       at java.io.FileOutputStream.write(FileOutputStream.java:300)

       at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:220)

       at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:290)

       at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:294)

       at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:140)

       - locked <0x9c551ec8> (a java.io.OutputStreamWriter)

       at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)

       at java.io.PrintWriter.flush(PrintWriter.java:293)

       - locked <0x9c551ec8> (a java.io.OutputStreamWriter)

       at org.apache.juli.FileHandler.publish(FileHandler.java:210)

       at java.util.logging.Logger.log(Logger.java:573)

       at java.util.logging.Logger.doLog(Logger.java:598)

       at java.util.logging.Logger.logp(Logger.java:714)

       at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:183)

       at org.apache.juli.logging.DirectJDKLog.error(DirectJDKLog.java:146)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.addEvent(NioEndpoint.java:1043)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1081)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1072)

       at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.release(Http11NioProtocol.java:221)

       at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:616)

       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1876)

       - locked <0x92350190> (a org.apache.tomcat.util.net.NioChannel)

       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)

       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

       at java.lang.Thread.run(Thread.java:701)

 

"catalina-exec-4" daemon prio=10 tid=0x90700800 nid=0x4a9 waiting for monitor entry [0x90883000]

   java.lang.Thread.State: BLOCKED (on object monitor)

       at java.io.PrintWriter.write(PrintWriter.java:427)

       - waiting to lock <0x9c551ec8> (a java.io.OutputStreamWriter)

       at java.io.PrintWriter.write(PrintWriter.java:446)

       at org.apache.juli.FileHandler.publish(FileHandler.java:208)

       at java.util.logging.Logger.log(Logger.java:573)

       at java.util.logging.Logger.doLog(Logger.java:598)

       at java.util.logging.Logger.logp(Logger.java:714)

       at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:183)

       at org.apache.juli.logging.DirectJDKLog.error(DirectJDKLog.java:146)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.addEvent(NioEndpoint.java:1043)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1081)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1072)

       at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.release(Http11NioProtocol.java:221)

       at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:616)

       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1876)

       - locked <0x9ce324f0> (a org.apache.tomcat.util.net.NioChannel)

       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)

       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

       at java.lang.Thread.run(Thread.java:701)

 

"catalina-exec-3" daemon prio=10 tid=0x91711800 nid=0x4a8 waiting for monitor entry [0x908d4000]

   java.lang.Thread.State: BLOCKED (on object monitor)

       at java.io.PrintWriter.write(PrintWriter.java:427)

       - waiting to lock <0x9c551ec8> (a java.io.OutputStreamWriter)

       at java.io.PrintWriter.write(PrintWriter.java:446)

       at org.apache.juli.FileHandler.publish(FileHandler.java:208)

       at java.util.logging.Logger.log(Logger.java:573)

       at java.util.logging.Logger.doLog(Logger.java:598)

       at java.util.logging.Logger.logp(Logger.java:714)

       at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:183)

       at org.apache.juli.logging.DirectJDKLog.error(DirectJDKLog.java:146)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.addEvent(NioEndpoint.java:1043)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1081)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1072)

       at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.release(Http11NioProtocol.java:221)

       at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:616)

       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1876)

       - locked <0x9cc577a0> (a org.apache.tomcat.util.net.NioChannel)

       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)

       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

       at java.lang.Thread.run(Thread.java:701)

 

"catalina-exec-2" daemon prio=10 tid=0x911df000 nid=0x4a7 waiting for monitor entry [0x90925000]

   java.lang.Thread.State: BLOCKED (on object monitor)

       at java.io.PrintWriter.write(PrintWriter.java:427)

       - waiting to lock <0x9c551ec8> (a java.io.OutputStreamWriter)

       at java.io.PrintWriter.write(PrintWriter.java:446)

       at org.apache.juli.FileHandler.publish(FileHandler.java:208)

       at java.util.logging.Logger.log(Logger.java:573)

       at java.util.logging.Logger.doLog(Logger.java:598)

       at java.util.logging.Logger.logp(Logger.java:714)

       at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:183)

       at org.apache.juli.logging.DirectJDKLog.error(DirectJDKLog.java:146)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.addEvent(NioEndpoint.java:1043)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1081)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1072)

       at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.release(Http11NioProtocol.java:221)

       at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:616)

       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1876)

       - locked <0x9ce18148> (a org.apache.tomcat.util.net.NioChannel)

       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)

       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

       at java.lang.Thread.run(Thread.java:701)

 

"catalina-exec-1" daemon prio=10 tid=0x093c7800 nid=0x4a6 waiting for monitor entry [0x90f5c000]

   java.lang.Thread.State: BLOCKED (on object monitor)

       at java.io.PrintWriter.write(PrintWriter.java:427)

       - waiting to lock <0x9c551ec8> (a java.io.OutputStreamWriter)

       at java.io.PrintWriter.write(PrintWriter.java:446)

       at org.apache.juli.FileHandler.publish(FileHandler.java:208)

       at java.util.logging.Logger.log(Logger.java:573)

       at java.util.logging.Logger.doLog(Logger.java:598)

       at java.util.logging.Logger.logp(Logger.java:714)

       at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:183)

       at org.apache.juli.logging.DirectJDKLog.error(DirectJDKLog.java:146)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.addEvent(NioEndpoint.java:1040)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1081)

       at org.apache.tomcat.util.net.NioEndpoint$Poller.add(NioEndpoint.java:1072)

       at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.release(Http11NioProtocol.java:221)

       at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:616)

       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1876)

       - locked <0x9cd925b8> (a org.apache.tomcat.util.net.NioChannel)

       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)

       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

       at java.lang.Thread.run(Thread.java:701)

可见默认的日志logger效率比较低,因为写文件是互斥锁。

查看at org.apache.juli.logging.DirectJDKLog.error(DirectJDKLog.java:146)

此处可以修改源码为更高效的日志组件。

 

1.4.5 启用压缩

    <Connector executor="tomcatThreadPool"

               port="8080" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443"

                 compression="on"

               compressionMinSize="2048"

/>

可以使得返回给client的数据量减少。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

参考

1 http://www.tuicool.com/articles/vU7bya3

2 http://itindex.net/detail/50701-tomcat-bio-nio.apr

3 http://www.365mini.com/page/tomcat-connector-mode.htm

4 http://www.oschina.net/question/54100_16195

5 http://blog.itpub.net/29510932/viewspace-1102187/

 

 

© 著作权归作者所有

共有 人打赏支持
强子1985

强子1985

粉丝 871
博文 1061
码字总数 757086
作品 8
南京
架构师
私信 提问
web服务器适合文件上传下载服务吗?

不去说具体的什么大文件、断点续传。我想问的是上传对服务器并发的影响。 假设线程池为200,如果有200个人同时在上传文件(小文件的话线程占满的情况小点,但是如果传的文件大点,就会导致同...

铂金小虫
2014/10/30
537
3
【新功能】ECS已过期实例续费变配功能上线

中国站ECS控制台,现已支持已过期的实例续费时,对实例规格进行变配。 功能特点 已过期实例续费变配与过去的续费降配有三点区别: 续费变配只可以续费同时修改实例规格配置,不可以修改带宽。...

郁苍
04/17
0
0
【新用户专享】腾讯云发车,360元三年1核2G云服务器

最近发现腾讯云有新用户专享活动,360元即可购买云服务器1核2G、1M带宽,加赠50GB对象存储空间。一般情况,阿里云腾讯云的1核1G云主机就算是促销时,价格也在 300元/1年 以上。如果有需求的,...

FuYung
03/07
0
0
《字符串连接你用+还是用StringBuilder》续

前言 前面的一篇文章《字符串连接你用+还是用StringBuilder》,有朋友找我反馈了一些问题,其中一位朋友说JDK10下生成的字节码跟文章中并不一样,这里继续看下是什么情况。 问题描述 如下图,...

超人汪小建
07/16
0
0
t-io框架使用中出现内存泄漏

我在我的服务器中加入了t-io的框架作为tcp 的连接,我用的是springmvc的框架,在使用中发现当tomcat开启后t-io会单独生成一个独立线程,当tomcat被关闭后,这个t-io所在的线程并没有被关闭,...

码码君
2017/08/31
98
2

没有更多内容

加载失败,请刷新页面

加载更多

OSChina 周二乱弹 —— 哥们之间报恩的想法被上帝实现了

Osc乱弹歌单(2018)请戳(这里) 【今日歌曲】 小小编辑:推荐歌曲《消愁》 《消愁》- 毛不易 手机党少年们想听歌,请使劲儿戳(这里) @过遥 :周一的早上就应该用来补觉,太困了 周末不想...

小小编辑
8分钟前
8
1
MariaDB 服务器在 MySQL Workbench 备份数据的时候出错如何解决

服务器是运行在 MariaDB 10.2 上面的,在使用 MySQL Workbench 出现错误: mysqldump: Couldn't execute 'SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"'......

honeymose
今天
3
0
apache顶级项目(二) - B~C

apache顶级项目(二) - B~C https://www.apache.org/ Bahir Apache Bahir provides extensions to multiple distributed analytic platforms, extending their reach with a diversity of s......

晨猫
今天
7
0
day152-2018-11-19-英语流利阅读

“超级食物”竟然是营销噱头? Daniel 2018-11-19 1.今日导读 近几年来,超级食物 superfoods 开始逐渐走红。不难发现,越来越多的轻食餐厅也在不断推出以超级食物为主打食材的健康料理,像是...

飞鱼说编程
今天
18
1
SpringBoot源码:启动过程分析(二)

接着上篇继续分析 SpringBoot 的启动过程。 SpringBoot的版本为:2.1.0 release,最新版本。 一.时序图 一样的,我们先把时序图贴上来,方便理解: 二.源码分析 回顾一下,前面我们分析到了下...

Jacktanger
昨天
4
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部