2016-12-02 131 views
0

我們正在運行的Solr 4.10,看到非常高響應時間:這是Solr中的內存泄漏嗎?

avgRequestsPerSecond:2.5 
5minRateReqsPerSecond:5.2 
75thPcRequestTime:3.45 
95thPcRequestTime:16.68 
99thPcRequestTime:1366.22 
999thPcRequestTime:3477.79 

在運行jstat -gc,我看到OC和OU都保持相等,而FGC不斷髮生。這清楚地表明瞭Solr中的內存泄漏,對嗎?我如何進一步分析?

jstat -gc 32110 1s | awk '{print $3 "\t" $4 "\t" $6 "\t" $7 "\t" $8 "\t" $15 }' 
S0U S1U  EU   OC   OU  FGC 
0.0 0.0 6632870.9 12582912.0 12402105.3 29902 
0.0 0.0 6684761.8 12582912.0 12402105.2 29902 
0.0 0.0 6691460.8 12582912.0 12402105.2 29902 
0.0 0.0 6694722.4 12582912.0 12402105.2 29903 
0.0 0.0 6694725.9 12582912.0 12402105.2 29904 
0.0 0.0 6695870.2 12582912.0 12402105.0 29904 
0.0 0.0 6729501.5 12582912.0 12402105.0 29904 
0.0 0.0 6732006.7 12582912.0 12402105.0 29906 
0.0 0.0 6733112.6 12582912.0 12402103.8 29906 
0.0 0.0 6741058.6 12582912.0 12402103.8 29906 
0.0 0.0 6758686.3 12582912.0 12402103.8 29907 
0.0 0.0 6759295.8 12582912.0 12402103.8 29908 
0.0 0.0 6764812.4 12582912.0 12402103.6 29908 
0.0 0.0 6915819.8 12582912.0 12402103.6 29908 
0.0 0.0 6927843.8 12582912.0 12402103.6 29909 
0.0 0.0 6936952.4 12582912.0 12402103.6 29910 
0.0 0.0 6938582.2 12582912.0 12402027.2 29910 
0.0 0.0 6965969.7 12582912.0 12402027.2 29910 
0.0 0.0 6965969.7 12582912.0 12402027.2 29911 
0.0 0.0 6966291.8 12582912.0 12402027.2 29912 
0.0 0.0 7018558.7 12582912.0 12402026.6 29912 
0.0 0.0 7021295.9 12582912.0 12402026.6 29912 
0.0 0.0 7022254.9 12582912.0 12402026.6 29913 
0.0 0.0 7064476.5 12582912.0 12402026.6 29914 
0.0 0.0 7067874.0 12582912.0 12402026.4 29914 
0.0 0.0 7070544.2 12582912.0 12402026.4 29914 
0.0 0.0 7076188.2 12582912.0 12402026.4 29916 
0.0 0.0 7076556.2 12582912.0 12402007.2 29916 
0.0 0.0 7101610.3 12582912.0 12402007.2 29916 
0.0 0.0 7156338.1 12582912.0 12402007.2 29917 
0.0 0.0 7158966.6 12582912.0 12402007.2 29918 
0.0 0.0 7172960.0 12582912.0 12402007.2 29918 
0.0 0.0 7174184.7 12582912.0 12402007.2 29918 
0.0 0.0 7278617.7 12582912.0 12402007.2 29919 
0.0 0.0 7321347.9 12582912.0 12402007.2 29920 
0.0 0.0 7473383.3 12582912.0 12401949.4 29920 
0.0 0.0 7478629.0 12582912.0 12401949.4 29920 
0.0 0.0 7560124.9 12582912.0 12401949.4 29921 
0.0 0.0 7586431.8 12582912.0 12401949.4 29922 
0.0 0.0 7587841.2 12582912.0 12401949.1 29922 
0.0 0.0 7607755.4 12582912.0 12401949.1 29922 
0.0 0.0 7656487.0 12582912.0 12401949.1 29923 
0.0 0.0 7662770.1 12582912.0 12401949.1 29924 
0.0 0.0 7662770.1 12582912.0 12401949.1 29924 
0.0 0.0 7810619.5 12582912.0 12401908.7 29924 
0.0 0.0 7915475.2 12582912.0 12401908.7 29924 
0.0 0.0 7916589.7 12582912.0 12401908.7 29925 
0.0 0.0 7923831.6 12582912.0 12401908.7 29926 
0.0 0.0 7927085.1 12582912.0 12401836.2 29926 
0.0 0.0 7947903.0 12582912.0 12401836.2 29926 
0.0 0.0 7994024.6 12582912.0 12401836.2 29926 
0.0 0.0 7994024.6 12582912.0 12401836.2 29927 
0.0 0.0 8041582.5 12582912.0 12401836.2 29928 
0.0 0.0 8057792.8 12582912.0 12401835.5 29928 
0.0 0.0 8151537.0 12582912.0 12401835.5 29928 
0.0 0.0 8151551.6 12582912.0 12401835.5 29929 
0.0 0.0 8152414.2 12582912.0 12401835.5 29930 
0.0 0.0 8159020.1 12582912.0 12401835.5 29930 
0.0 0.0 8159020.1 12582912.0 12401834.4 29930 
0.0 0.0 8169436.4 12582912.0 12401834.4 29930 
0.0 0.0 8170238.0 12582912.0 12401834.4 29931 
0.0 0.0 8172264.0 12582912.0 12401834.4 29932 
0.0 0.0 8193949.3 12582912.0 12401796.7 29932 
0.0 0.0 8194900.5 12582912.0 12401796.7 29932 
0.0 0.0 8204694.2 12582912.0 12401796.7 29933 
0.0 0.0 8207894.7 12582912.0 12401796.7 29934 
0.0 0.0 8207894.7 12582912.0 12401796.7 29934 
0.0 0.0 8224413.5 12582912.0 12401796.5 29934 
0.0 0.0 8229298.6 12582912.0 12401796.5 29934 
0.0 0.0 8233077.3 12582912.0 12401796.5 29935 
0.0 0.0 8233100.2 12582912.0 12401796.5 29936 
0.0 0.0 8291558.6 12582912.0 12401796.2 29936 
0.0 0.0 8294201.9 12582912.0 12401796.2 29936 
0.0 0.0 8376223.8 12582912.0 12401796.2 29937 
0.0 0.0 8376223.8 12582912.0 12401796.2 29937 
0.0 0.0 8430118.2 12582912.0 12401796.2 29938 
0.0 0.0 8434741.0 12582912.0 12401710.7 29938 
0.0 0.0 8526729.6 12582912.0 12401710.7 29938 
0.0 0.0 8555110.4 12582912.0 12401710.7 29939 
0.0 0.0 8579409.8 12582912.0 12401710.7 29940 
0.0 0.0 8579409.8 12582912.0 12401710.7 29940 
0.0 0.0 8695038.1 12582912.0 12401643.6 29940 
0.0 0.0 8696711.3 12582912.0 12401643.6 29940 
0.0 0.0 8696711.3 12582912.0 12401643.6 29941 
0.0 0.0 8737284.3 12582912.0 12401643.6 29942 
0.0 0.0 8737284.3 12582912.0 12401643.6 29942 
0.0 0.0 8772882.9 12582912.0 12401642.1 29942 
0.0 0.0 8775170.0 12582912.0 12401642.1 29942 
0.0 0.0 8775170.0 12582912.0 12401642.1 29943 
0.0 0.0 8794554.3 12582912.0 12401642.1 29944 
0.0 0.0 8794767.2 12582912.0 12401642.1 29944 
0.0 0.0 8824500.6 12582912.0 12401581.8 29944 
0.0 0.0 8826083.6 12582912.0 12401581.8 29944 
0.0 0.0 8826083.6 12582912.0 12401581.8 29945 
0.0 0.0 8911554.7 12582912.0 12401581.8 29946 
0.0 0.0 8911554.7 12582912.0 12401581.8 29946 
0.0 0.0 8958907.7 12582912.0 12401467.2 29946 
0.0 0.0 8959676.5 12582912.0 12401467.2 29946 
0.0 0.0 8959676.5 12582912.0 12401467.2 29947 
0.0 0.0 8964523.1 12582912.0 12401467.2 29948 
0.0 0.0 8964523.1 12582912.0 12401467.2 29948 
0.0 0.0 8987262.5 12582912.0 12401467.2 29948 
0.0 0.0 8992354.3 12582912.0 12401467.2 29948 
0.0 0.0 8992354.3 12582912.0 12401467.2 29949 
0.0 0.0 8993935.5 12582912.0 12401467.2 29950 
0.0 0.0 8993935.5 12582912.0 12401467.2 29950 
0.0 0.0 9004951.2 12582912.0 12401466.4 29950 
0.0 0.0 9014431.4 12582912.0 12401466.4 29950 
0.0 0.0 9014431.4 12582912.0 12401466.4 29951 

這裏是我的JVM參數:

-Xloggc:tomcat7/logs/gc.log 
-Xmx24g 
-Xms24g 
-XX:+UseConcMarkSweepGC 
-XX:MaxPermSize=256m 
-XX:MaxNewSize=12G 
-XX:NewSize=12G 
-XX:SurvivorRatio=6 
-XX:+UseCMSInitiatingOccupancyOnly 
-XX:CMSInitiatingOccupancyFraction=80 
-XX:TargetSurvivorRatio=80 
-XX:MaxTenuringThreshold=8 
-XX:+UseConcMarkSweepGC 
-XX:+CMSScavengeBeforeRemark 
-XX:PretenureSizeThreshold=512m 
-XX:CMSFullGCsBeforeCompaction=1 
-XX:CMSTriggerPermRatio=80 
-XX:CMSMaxAbortablePrecleanTime=6000 
-XX:+CMSConcurrentMTEnabled 
-XX:+UseParNewGC 
-XX:ConcGCThreads=6 
-XX:ParallelGCThreads=6 
-XX:+UseLargePages 
-XX:+PrintGCApplicationStoppedTime 
-XX:+PrintHeapAtGC 
-XX:+PrintGCDetails 
-XX:+PrintGCDateStamps 
-XX:+PrintGCTimeStamps 
-XX:+PrintTenuringDistribution 
-XX:ThreadStackSize=256 

回答

0

除了Solr的是使用大量的內存,您不能從這個有限的數據推斷出任何東西。在jstat輸出結束時使用的總內存(加起來的EU和OU)只顯示20.7GB的主堆在使用中。如果我們假設其他內存池具有典型大小,那麼Java使用的內存總量可能會略少於22GB,至少會留下2GB的尚未分配的堆。

你在日誌中遇到OutOfMemoryError了嗎?這個Solr實例處理的索引有哪些統計信息 - 文檔數量,刪除的文檔數量,索引大小等等?您需要有關垃圾收集的長期信息才能確定是否存在內存泄漏。內存泄漏在Solr中非常罕見,我不知道最近有哪些歷史記錄。

+0

如果Solr中沒有內存泄漏,那麼爲什麼FGC事件沒有清除OU內存?是否有一個粗略的公式可以用來了解Solr對於給定數量的文檔和查詢所需的堆內存? (只是大概,不一定準確)。 請注意,我必須在每隔幾個小時後重新啓動計算機,因爲它們花費太長時間來響應任何查詢。 也在gc.log中,我看到由於這些GC事件而導致應用程序線程過於頻繁地停止,速度約爲每秒500毫秒。 – user2250246

+0

GC無法釋放仍在使用中的內存。內存仍在使用中。 無法提供所需的堆內存指導,甚至是* general *指導。有太多的變數。 https://lucidworks.com/blog/sizing-hardware-in-the-abstract-why-we-dont-have-a-definitive-answer/ https://wiki.apache.org/solr/ SolrPerformanceProblems#Java_Heap – elyograg