JSONB, a structured format for storing JSON has been introduced in a message by Andrew Dunstan posted on PostgreSQL’s website. Andrew Dunstan authored JSONB together with Oleg Bartunov, Teodor Sigaev, and Peter Geoghegan; and reviewed by Andres Freund. Andrew described that this new format accepts the same data as the JSON type yet it is stored in a format that does not need reparsing the original text in order to process it. This process makes it more ideal for indexing and other operations wherein irrelevant whitespace is removed and order of object keys is not kept. Also, duplicate objects keys are not kept – the only one stored is the later value for a given key.
He also mentioned that this features was created out of the previous work by Oleg Bartunov and Teodor Sigaev which aimed to offer similar facilities to a nested HStore type, however, it was later on verified to have some major compatibility issues.
Meanwhile, Peter Geoghegan wrote in his blog that jsonb_hash_ops alternate GIN operator class by Alexander Korotkov, one of the contributor of JSONB not credited in the JSONB commit message, deserves an honorable mention. “By combining GIN with hashing of either key/value pairs, or array elements, resulting indexes can give great performance for sophisticated “containment” type queries against JSON documents. Indexes are a fraction of the size of the data indexed, index scans are incredibly fast, and yet these GIN indexes make indexable very complex nested “containment” queries. The results are so impressive that at last November’s pgConf.EU conference, an EXPLAIN ANALYZE comparative example in a presentation given by Oleg and Teodor was greeted with sustained applause.” Peter mentioned.
JSONB has made in the upcoming 9.4 release of PostgreSQL, an open source Object-Relational Database Management System (ORDBMS) known for its reliability, data integrity and correctness.
The following are developers’ reviews on JSONB and JSON:
Important usages of JSON and JSONB
- Use JSONB for quick JSON manipulation inside PostgreSQL such as sorting, slicing, splicing, etc.
- Use JSONB on indexed lookups for arbitrary key searches on JSON.
- Use JSON if you are not doing any of the above.
- Use JSON to preserve key ordering, whitespace, and duplicate keys.
Disadvantages of JSON and JSONB
- JSONB usually takes more disk space to store than JSON.
- JSONB takes more time to build form its input representation than JSON.
- JSON operations take considerably more time than JSONB (& parsing also needs to be done each time you do some operation at a JSON typed value).
The most awaited JCACHE also known as JSR 107 – Java Temporary Caching API has finally been released in March 18, 2014. This specification request has been started way back in 2001, nevertheless, over 80% voted for its inclusion in the platform on a 2012 Java EE 7 survey.
In the original proposal posted in the Java Community Process’ website, JCACHE has been described as a specification that standardize process caching of Java objects in a way that allows an efficient implementation, and removes from the programmer the burden of implementing cache expiration, mutual exclusion, spooling, and cache consistency. Objects whose type is not known until runtime can be cached, but only those which implement the serializable interface can be spooled.
The main purpose of JCACHE is to let developers solve usual problems by only writing little code as possible. This will work on any Java platform and will be beneficial to server platforms like servlet container.
It is also said that there are no specifications yet that handle automatic creation and refresh of temporary, in-process data shared across threads. The following are mentioned issues with existing specifications that can be addressed through JCACHE:
Java Naming Directory Interface (JNDI) is used for searching objects by name and an interface for caching implementation. But this application requires checking expiration of retrieved objects after each look up, and synchronizing creation and binding of a new object. Per object cache attributes (e.g., expiration time) would require introduction of an additional level of indirection: the application would look up a cache handle and use one of its methods to access the associated object.
Java.util.Hashtable offers a way of searching objects by name, however, has no way to materialize objects in the cache without application enforcement of expiration and mutual exclusion. HashTable also has no basic spooling capability.
JavaSpaces and Enity Enterprise Java Beans handle caching of persistent, transactional data. Cached data do not always come from data stores; they may be the result of an expensive computation or a remote procedure call. Also, these interfaces do not deal with efficient handling of expiration and refresh of cached data.
Enterprise Java Beans are mainly created for remote access to objects. Although an in-process implementation of EJB is possible, the application code would still have to make all of the additional calls required for remote object access. EJB’s must be pre-defined by the application, and do not have any concept of shared access or expiration.
javax.servlet.http.HttpSession permits named objects of arbitrary type to be cached, but does not have the concept of sharing, invalidation, per object expiration, automatic loading, or spooling.
With its release, JCACHE is now available for download and evaluation.
Besides the usual Java/Java EE/Spring technologies we use, here are other technologies we used in 2013.
- Amazon Web Services
- Crystal Reports
- Excel VBA
- Google Maps API
- Jasper Reports
- PayPal API
- Play Framework
Here are the topics we have written news articles about in 2013.
- Apache Kafka
- Everything About Java 8
- Cloud Application Foundation
- JDK 8
- jQuery 2.0
- Java API for JSON Processing
- Spring for Hadoop
- Java Time API
- Apache Isis
Here are the topics of our blog posts in 2013.
- Root Context in your Webapp
- Tomcat With No Context Path and Behind Apache
- SSL Notes
- Font ‘Arial’ is not available to the JVM
- Smack Enhanced Debugger
- How to Add Cipher Suites Support in Openfire and Smack
- Date Binding in Spring MVC
- MySQL Got a packet bigger than ‘max_allowed_packet’ bytes
- Cannot Connect Remotely to a New MySQL Installation
- JodaTime setCurrentMillisSystem()
- Running Two Instances of Tomcat
- Automated MySQL Backup