[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openejb-user
Subject:    Re: org.apache.johnzon.core.JsonReaderFactoryImpl
From:       ravi <sankar_ravi_c () yahoo ! co ! in>
Date:       2016-03-31 5:32:12
Message-ID: 1459402332049-4678028.post () n4 ! nabble ! com
[Download RAW message or body]

Hi Romain,

After looking in to the code of JsonParserFactoryImpl.java

  public static final String MAX_STRING_LENGTH =
"org.apache.johnzon.max-string-length";
  public static final int DEFAULT_MAX_STRING_LENGTH =
Integer.getInteger(MAX_STRING_LENGTH, 10 * 1024 * 1024); //10m

valueBufferProvider  is holding the 20 megabytes of data in heap.

If my understanding is correct org.apache.johnzon.max-string-length
determines the max length of the json field or json value.

For general use cases json field names and values are very small strings
unless we are trying to exchange some binary data using json.

I feel allocating 20 mega bytes of heap memory for processing field names or
values is too big.

Is there any thing we can do to optimize it. like starting with small size
and dynamically increase the *valueBufferProvider *size when ever required
until it reaches a maximum value.

I tried the option -Dorg.apache.johnzon.max-string-length=5 for the parsing
the below json string
{
  "hello_world":"test"
}

and got org.apache.johnzon.mapper.MapperException: Too many characters.
Maximum string/number length of 5 exceeded

Is it possible have a min value and max value and exception should be thrown
once the max string/number length is reached?

Thanks,
Ravi
    



--
View this message in context: \
http://tomee-openejb.979440.n4.nabble.com/org-apache-johnzon-core-JsonReaderFactoryImpl-tp4678011p4678028.html
 Sent from the TomEE Users mailing list archive at Nabble.com.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic