Hello, I guess the problem may be with the way you build the binary object - by using the integers as field names. It forces Ignite to execute a global transaction to update the "category" type's metadata every time you invoke binary.build(). The update is required because the schema of the new binary object is not the same as that of the previous one (most likely, because the list of integers is not the same).
By design, Ignite Binary expects a binary type (such as "category" in your case) to have a fairly stable schema since it reflects a domain class in your application. As such, the schema is expected to be updated relatively infrequently, for example, when the domain class changes in the next release of the application. Long story short, you'll be better off by storing the Map as a single field of the binary type "category". Hope it helps. Andrey > Date: Wed, 20 Apr 2016 07:00:28 -0700 > From: [email protected] > To: [email protected] > Subject: BinaryObject performance issue > > Hello! > I need to put <Long, Map<Integer, String>> data structure to cache. > I have found out that there is a BinaryObject, that solves the problem of > dynamic fields list and improves cache query operations performance. > But I faced a performance issue. > > I have 3 node cluster with 5GB of RAM. I want to add 5 000 entries into > cache. > In case I put <Long, Map<Integer, String>> it takes over* 6,8 seconds* > In case I put <Long, BinaryObject> it takes *382 seconds* > > I use atomic partitioned cache. Here is code example with BinaryObject: > > Map<Person, List<Integer>> persons = ... //original data > structure > IgniteCache<Long, BinaryObject> personCache = > Ignition.ignite().cache(PERSON_CACHE); > > IgniteBinary binary = Ignition.ignite().binary(); > > persons.forEach((person, integers) -> { > BinaryObjectBuilder valBuilder = > binary.builder("categories"); > integers.stream().forEach((integer -> { > valBuilder.setField(String.valueOf(integer), > integer); > })); > personCache.put(person.getId(), valBuilder.build()); > }); > > > Is that expected behaviour? > > > > -- > View this message in context: > http://apache-ignite-users.70518.x6.nabble.com/BinaryObject-performance-issue-tp4375.html > Sent from the Apache Ignite Users mailing list archive at Nabble.com.
