简体   繁体   English

RESTHEART引发异常

[英]RESTHEART throwing exceptions

we implemented RESTHEART to get aggregated data from MongoDB. 我们实现了RESTHEART,以从MongoDB获取汇总数据。 For single requests , the data is coming up fine and meets the requirement. 对于单个请求,数据可以很好地满足要求。 When we started checking this under JMeter requests by adding load on MongoDB we got exceptions at backend. 当我们通过在MongoDB上添加负载开始在JMeter请求下对此进行检查时,后端出现了异常。 We shared these exceptions with MongoDB engineers and they are indicating it could be because of restheart api issue. 我们与MongoDB工程师共享了这些例外,他们表示这可能是由于restheart api问题引起的。 Has anyone faced these issues before? 有人遇到过这些问题吗?

@Andrea Di Cesare , any help on this will be greatly appreciated. @Andrea Di Cesare,在此方面的任何帮助将不胜感激。

Below is detail Below are the examples URI which error out with “Out of memory”. 以下是详细信息以下是示例URI,其错误显示为“内存不足”。 REST API CALLS http://ftc-lbeapoc202:8080/statdata/InsStatData/_aggrs/getStatDataByIssuerIdSectionName?avars= {'issuerId':66915,'sectionName':'SCDPT1'} http://ftc-lbeapoc202:8080/statdata/InsStatData/_aggrs/getStatDataByIssuerIdSectionName?avars= {'issuerId':66915,'sectionName':'SCDPT1','year':2014} REST API调用http:// ftc-lbeapoc202:8080 / statdata / InsStatData / _aggrs / getStatDataByIssuerIdSectionName?avars = {'issuerId':66915,'sectionName':'SCDPT1'} http:// ftc-lbeapoc202:8080 / statdata / InsStatData / _aggrs / getStatDataByIssuerIdSectionName?avars = {'issuerId':66915,'sectionName':'SCDPT1','year':2014}

Error in server log: 服务器日志中的错误:

[[1;31mERROR^[[0;39m org.restheart.handlers.ErrorHandler - Error handling 
the request
java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:3554)
    at java.util.Arrays.copyOf(Arrays.java:3525)
    at java.util.ArrayList.grow(ArrayList.java:272)
    at java.util.ArrayList.ensureExplicitCapacity(ArrayList.java:246)
    at java.util.ArrayList.ensureCapacityInternal(ArrayList.java:238)
    at java.util.ArrayList.add(ArrayList.java:469)
    at org.bson.codecs.BsonDocumentCodec.decode(BsonDocumentCodec.java:84)
    at org.bson.codecs.BsonDocumentCodec.decode(BsonDocumentCodec.java:41)
    at com.mongodb.operation.CommandResultArrayCodec.decode(CommandResultArrayCodec.java:52)
    at com.mongodb.operation.CommandResultDocumentCodec.readValue(CommandResultDocumentCodec.java:53)
    at org.bson.codecs


Error in response:
{
 ·         _exceptions: 
[
o    {
§  exception: "java.lang.OutOfMemoryError",
§  exception message: "Java heap space"
}
],
 ·         http status code: 500,
  ·         http status description: "Internal Server Error",
  ·         message: "Error handling the request, see log for more 
  information"
 }

 Thanks!

RESTHeart is a plain Java application and what you see is a java.lang.OutOfMemoryError exception. RESTHeart是一个普通的Java应用程序,您看到的是一个java.lang.OutOfMemoryError异常。 It means your tests are using all the available JVM's heap space, so the JVM is going out of memory. 这意味着您的测试正在使用所有可用的JVM的堆空间,因此JVM的内存不足。

By default: 默认:

Java 8 takes Larger of 1/6th of your physical memory for your -Xms<size> (Minimum HeapSize) and Smaller of 1/4th of your physical memory for your -Xmx<size> (Maximum HeapSize). Java 8占用-Xms<size> (最小HeapSize)的物理内存的1/6的较大值,以及-Xmx<size> (最大HeapSize)的物理内存的1/4的较小值。

In Linux or Mac OS systems you can check your default Heap size with: 在Linux或Mac OS系统中,您可以使用以下方法检查默认的堆大小:

java -XX:+PrintFlagsFinal -version | grep -iE HeapSize

If your server has enough available physical memory, you can try running RESTHeart with a bigger heap, adding the -Xmn<size> parameter to the command line. 如果服务器具有足够的可用物理内存,则可以尝试使用更大的堆运行RESTHeart,然后将-Xmn<size>参数添加到命令行。

For example: java -Xmx3072m will set the JVM's maximum heap size to 3GB. 例如: java -Xmx3072m会将JVM的最大堆大小设置为3GB。

Rif: https://docs.oracle.com/cd/E15523_01/web.1111/e13814/jvm_tuning.htm#PERFM164 里夫(Rif): https : //docs.oracle.com/cd/E15523_01/web.1111/e13814/jvm_tuning.htm#PERFM164

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM