Hi, I have been looking at Geode-s code and come across major performance killer for JSON handling in Geode, namely implementation of com.gemstone.gemfire.pdx.internal.PdxInstanceImpl#getObject
as you can see in the snipped below the code creates ObjectMapper every time it needs to convert PDX instance into JSON. According to docs and examples on Jackson’s site instances of ObjectMapper should be shared globally. Creating it for every transaction is quite expensive in terms of CPU and garbage collection. Another thing is date format, in the JSON land it is pretty much settled to be ISO 8661 https://weblog.west-wind.com/posts/2014/Jan/06/JavaScript-JSON-Date-Parsing-and-real-Dates It would be nice to be able to have Geode’s JSON standard compliant, or have this configurable. public Object getObject() { if (getPdxType().getNoDomainClass()) { //In case of Developer Rest APIs, All PdxInstances converted from Json will have a className =__GEMFIRE_JSON. //Following code added to convert Json/PdxInstance into the Java object. if(this.getClassName().equals("__GEMFIRE_JSON")){ //introspect the JSON, does the @type meta-data exist. String className = extractTypeMetaData(); if(StringUtils.hasText(className)) { try { ObjectMapper mapper = new ObjectMapper(); mapper.setDateFormat(new SimpleDateFormat("MM/dd/yyyy")); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); String JSON = JSONFormatter.toJSON(this); Object classInstance = mapper.readValue(JSON, ClassPathLoader.getLatest().forName(className)); return classInstance; }catch(Exception e){ throw new PdxSerializationException("Could not deserialize as java class type could not resolved", e); } } } return this; } Regards, Konstantin Ignatyev ---------------------------------------------------------------------- This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, notify the sender immediately by return email and delete the message and any attachments from your system.
