![龙之队|一次线上JVM内存溢出分析,GC分析、MAT、gcviewer]()
终于找到了与tomcat相关的类了 , 开心!!!!!
?public class Nio2Endpoint extends AbstractJsseEndpoint {...@Overridepublic void bind() throws Exception {?// Create worker collectionif (getExecutor() == null) {createExecutor();// 统一在这个方法创建线程池}if (getExecutor() instanceof ExecutorService) {threadGroup = AsynchronousChannelGroup.withThreadPool((ExecutorService) getExecutor());}// AsynchronousChannelGroup needs exclusive access to its executor serviceif (!internalExecutor) {log.warn(sm.getString("endpoint.nio2.exclusiveExecutor"));}?serverSock = AsynchronousServerSocketChannel.open(threadGroup);socketProperties.setProperties(serverSock);InetSocketAddress addr = new InetSocketAddress(getAddress(), getPortWithOffset());serverSock.bind(addr, getAcceptCount());?// Initialize SSL if neededinitialiseSsl();}...@Overridepublic void startInternal() throws Exception {?if (!running) {allClosed = false;running = true;paused = false;?if (socketProperties.getProcessorCache() != 0) {processorCache = new SynchronizedStack<>(SynchronizedStack.DEFAULT_SIZE,socketProperties.getProcessorCache());}if (socketProperties.getBufferPool() != 0) {nioChannels = new SynchronizedStack<>(SynchronizedStack.DEFAULT_SIZE,socketProperties.getBufferPool());}?// Create worker collectionif (getExecutor() == null) {createExecutor();// 统一在这个方法创建线程池}?initializeConnectionLatch();startAcceptorThread();}}...}/** * AprEndpoint使用JNI的接口来获得对Socket的访问 * NioEndpoint 同步 * Nio2Endpoint 异步 */// 调用 NioEndpoint、Nio2Endpoint、AprEndpoint的父类AbstractEndpoint#createExecutor()方法public abstract class AbstractEndpoint {...// 创建线程池public void createExecutor() {internalExecutor = true;TaskQueue taskqueue = new TaskQueue();// 找到了我们的类 TaskThreadFactoryTaskThreadFactory tf = new TaskThreadFactory(getName() + "-exec-", daemon, getThreadPriority());executor = new ThreadPoolExecutor(getMinSpareThreads(), getMaxThreads(), 60, TimeUnit.SECONDS,taskqueue, tf);taskqueue.setParent( (ThreadPoolExecutor) executor);}...}?【龙之队|一次线上JVM内存溢出分析,GC分析、MAT、gcviewer】上面涉及到Tomcat的网络NIO架构 , 大家更感兴趣的可以百度搜索相关文章 。 Nio2Endpoint的作用大致就是为Http请求分配线程执行 , 到这里大概明白byte[]数组就是分配在每一个tomact线程中 , 因为使用了Nio , 就会有Buffer概念 , 那么这部分的内存是不能回收的 , 系统启动之后就一直不变 。 而且随着配置的tomcat线程server.tomcat.maxThreads越多占用的内存空间就越大 。
随着配置的tomcat线程越多占用的内存空间就越大?
这个时候我联想到了配置文件 , 查看原来配置文件:application.yml
server:port: 80tomcat:uri-encoding: UTF-8maxHttpPostSize: 10240000maxHttpHeaderSize: 10240000maxThreads: 500acceptCount: 500maxConnections: 600minSpareThreads: 100
推荐阅读
-
-
「狗狗」当狗狗有这些“行为”,简直是把自己当人看了
-
数字e家带领Google转型为科技巨头施密特离开了其顾问一职
-
快乐屋娱乐|他5岁时才刚刚开始他的事业,他抗拒的三个,张子枫自爆辛酸经历
-
中国民航网|助力当地全面建成小康社会,?天津航空:走进大美新疆
-
-
-
如果是这样你不要悲哀是什么歌?如果是这样像梦一场是什么歌
-
【社区】无接触配送安全放心,“长江严选”等社区团购成市民买菜
-
美女健康之路|保持好你的身材,只需每天走7116步,不想越來越胖
-
吉星|下个礼拜,4属相吉星近身,运旺财旺桃花旺,为家里添福添财
-
-
「伏地魔」“吃鸡”中常见的决赛圈打法,伏地魔已成过去,它才是新的王道!
-
网上都说联通好,电信快,为什么很多人还是选择中国移动? 移动联通电信哪个好
-
『买车大家帮』将于本月上市,EXEED星途VX实车曝光
-
清风徐来星海发|将是一批打工族的首选,马云:2020年这门小生意赚钱新商机
-
一条小团团|小团团自己都忍不了了!正面回应节食减肥,却被粉丝破坏计划
-
智人|高级文明将人类圈养,死亡后收取灵魂,让文明变得更加强大?
-
「快科技」你的电视准备好HDMI 2.1接口了吗?,PS5将在5月揭幕
-
女子控诉岳云鹏骗婚 要求验DNA-岳云鹏憨厚人设要翻车了吗?