0

我在 Heroku 和可搜索插件上使用 Grails 2.3.7。我有 2 个 512Mb RAM 的节点。我的应用在 Grails 2.3.5 上运行良好,但现在在 Grails 2.3.7 上就不那么好了。自从我更新后,我注意到内存跳跃了 10-30%(之前我以 100% 到 102% 运行,现在我从 116% 到 130%)。所以我开始做一些调整,取出插件..等等。尝试降低内存使用率。

我在日志中注意到的一件事是可搜索索引现在无法构建:

.964 .918931- - Exception in thread "Thread-8" org.compass.gps.CompassGpsException: Failed to index, execution exception; nested exception is java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
33.966 .918931- - java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
33.966 .919447- - at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
33.966 .919447- - at java.util.concurrent.FutureTask.get(FutureTask.java:111)
33.966 .919447- - at org.compass.gps.device.support.parallel.ConcurrentParallelIndexExecutor.performIndex(ConcurrentParallelIndexExecutor.java:122)
33.966 .919447- - at org.compass.gps.device.support.parallel.AbstractParallelGpsDevice.index(AbstractParallelGpsDevice.java:119)
33.966 .919447- - at org.compass.gps.impl.DefaultReplaceIndexCallback.buildIndexIfNeeded(DefaultReplaceIndexCallback.java:42)
33.966 .919577- - at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager$ReplaceIndexOperationCallback.firstStep(DefaultLuceneSearchEngineIndexManager.java:281)
33.969 .919577- - at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager.doOperate(DefaultLuceneSearchEngineIndexManager.java:218)
33.969 .919814- - at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager.doReplaceIndex(DefaultLuceneSearchEngineIndexManager.java:266)
33.969 .919814- - at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager.replaceIndex(DefaultLuceneSearchEngineIndexManager.java:261)
33.969 .919814- - at org.compass.gps.impl.SingleCompassGps.doIndex(SingleCompassGps.java:118)
33.969 .919928- - at org.compass.gps.impl.AbstractCompassGps.index(AbstractCompassGps.java:154)
33.969 .919928- - at org.compass.gps.impl.AbstractCompassGps.index(AbstractCompassGps.java:128)
33.969 .920000- - at grails.plugin.searchable.internal.compass.CompassGpsUtils.index(CompassGpsUtils.java:49)
34.046 .920000- - at grails.plugin.searchable.internal.compass.index.DefaultIndexMethod.invoke(DefaultIndexMethod.java:90)
34.046 .920050- - at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
34.046 .920050- - at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
34.046 .920120- - at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
34.046 .920258- - at java.lang.reflect.Method.invoke(Method.java:616)
34.046 .920258- - a`enter code here`t org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSite.invoke(PojoMetaMethodSite.java:189)
34.046 .920258- - at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
34.046 .920258- - at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
34.046 .920258- - at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
34.046 .920451- - at grails.plugin.searchable.SearchableService.index(SearchableService.groovy:149)
34.046 .920607- - at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
34.046 .920747- - at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
34.046 .920747- - at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
34.046 .920747- - at java.lang.reflect.Method.invoke(Method.java:616)
34.046 .920983- - at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
34.046 .920983- - at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
34.049 .920983- - at groovy.lang.MetaMethod$doMethodInvoke.call(Unknown Source)
34.049 .920983- - at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
34.049 .920983- - at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
34.049 .921091- - at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
34.049 .921200- - at GrailsMelodyGrailsPlugin$_closure4_closure16_closure17.doCall(GrailsMelodyGrailsPlugin.groovy:184)
34.049 .921200- - at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
34.049 .921200- - at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
34.049 .921457- - at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
34.051 .921457- - at java.lang.reflect.Method.invoke(Method.java:616)
34.051 .921644- - at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
34.051 .921687- - at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:80)
34.051 .921804- - at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1108)
34.051 .921896- - at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:910)
34.051 .921896- - at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:39)
34.051 .921896- - at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
34.051 .922051- - at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
34.127 .922051- - at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
34.127 .922051- - at BootStrap$_closure1_closure4.doCall(BootStrap.groovy:191)
34.127 .922222- - at BootStrap$_closure1_closure4.doCall(BootStrap.groovy)
34.127 .922222- - at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
34.127 .922421- - at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
34.127 .922421- - at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
34.127 .922421- - at java.lang.reflect.Method.invoke(Method.java:616)
34.127 .922421- - at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
34.127 .922421- - at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
34.127 .922578- - at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1086)
34.127 .922578- - at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
34.127 .922578- - at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:910)
34.127 .922578- - at groovy.lang.Closure.call(Closure.java:411)
34.127 .922718- - at groovy.lang.Closure.call(Closure.java:405)
34.127 .922718- - at groovy.lang.Closure.run(Closure.java:492)
34.127 .922911- - at java.lang.Thread.run(Thread.java:679)
34.127 .923199- - Caused by: java.lang.OutOfMemoryError: Java heap space
34.127 .923249- - at java.lang.reflect.Array.newArray(Native Method)
34.127 .923354- - at java.lang.reflect.Array.newInstance(Array.java:70)
34.127 .923354- - at org.hibernate.type.descriptor.java.ArrayMutabilityPlan.deepCopyNotNull(ArrayMutabilityPlan.java:44)
34.127 .923482- - at org.hibernate.type.descriptor.java.MutableMutabilityPlan.deepCopy(MutableMutabilityPlan.java:58)
34.127 .923550- - at org.hibernate.type.AbstractStandardBasicType.deepCopy(AbstractStandardBasicType.java:314)
34.127 .923550- - at org.hibernate.type.AbstractStandardBasicType.deepCopy(AbstractStandardBasicType.java:310)
34.127 .923598- - at org.hibernate.type.TypeHelper.deepCopy(TypeHelper.java:68)
34.127 .923673- - at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:230)
34.127 .923673- - at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:982)
34.127 .923673- - at org.hibernate.loader.Loader.loadSingleRow(Loader.java:331)
34.130 .923673- - at org.hibernate.impl.ScrollableResultsImpl.prepareCurrentRow(ScrollableResultsImpl.java:254)
34.130 .923762- - at org.hibernate.impl.ScrollableResultsImpl.next(ScrollableResultsImpl.java:123)
34.130 .923953- - at org.compass.gps.device.hibernate.indexer.ScrollableHibernateIndexEntitiesIndexer.performIndex(ScrollableHibernateIndexEntitiesIndexer.java:129)
34.130 .923953- - at org.compass.gps.device.support.parallel.ConcurrentParallelIndexExecutor$1$1.doInCompassWithoutResult(ConcurrentParallelIndexExecutor.java:104)
34.130 .923953- - at org.compass.core.CompassCallbackWithoutResult.doInCompass(CompassCallbackWithoutResult.java:29)
34.130 .923953- - at org.compass.core.CompassTemplate.execute(CompassTemplate.java:133)
34.130 .923953- - at org.compass.gps.impl.SingleCompassGps.executeForIndex(SingleCompassGps.java:147)
34.132 .923953- - at org.compass.gps.device.support.parallel.ConcurrentParallelIndexExecutor$1.call(ConcurrentParallelIndexExecutor.java:102)
34.132 .924092- - at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
34.132 .924092- - at java.util.concurrent.FutureTask.run(FutureTask.java:166)
34.132 .924196- - at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
34.132 .924196- - at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
34.132 .924196- - ... 1 more

看起来它用完了堆空间。这让我想问大家,在不跳转到 2 x 1Gb 节点的情况下调整 Heroku 的可搜索插件或 grails 的最佳方法是什么?

4

0 回答 0