0

I am reading very small yaml files (3 kb to 330 kb) , converting into the JsoneNode and then converting it into OpenAPI objects, while I am deploying my code on a k8 setup, I can see huge memory spike like 500-600 MB during the below code run: ,

String content = ClasspathHelper.loadFileFromClasspath("test.yaml");

final JsonNode jsonNode = JSON_MAPPER_FOR_YAML.readTree(content); //here JSON_MAPPER_FOR_YAML = ObjectMapperFactory.createYaml();

OpenAPI openAPI = new OpenAPIDeserializer().deserialize(jsonNode, path, new ParseOptions())

//Earlier ,I had tried below option as well but of no use in terms of memory spikes

OpenAPI openAPI = new OpenAPIV3Parser().parseJsonNode("/" + "test.yaml", jsonNode).getOpenAPI()

Trying to understand how such small yaml files can cause 500-600 MB memory spikes . I dont see such memory spikes when I run the same code in intellij and use jprofiler to see the memory .

Any one has any idea?

https://github.com/swagger-api/swagger-parser/blob/master/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/OpenAPIDeserializer.java

Vaibhav
  • 169
  • 6
  • I can see below jvm args that being used: spec: containers: - args: - --enable-preview - -Xmx6144m - -XX:InitiatingHeapOccupancyPercent=20 - -XX:SurvivorRatio=10 - -XX:ReservedCodeCacheSize=32m - -XX:+OptimizeStringConcat - -Xss256k - -XX:TargetSurvivorRatio=90 - -XX:MaxTenuringThreshold=16 - -XX:+UseG1GC - -XX:+UseStringDeduplication - -jar - abc.jar - -XX:+ShowCodeDetailsInExceptionMessages – Vaibhav Oct 01 '22 at 19:07
  • does anyone have any idea? – Vaibhav Oct 02 '22 at 13:52

0 Answers0