TLDR: Do you know the pros/cons of utilizing an in-memory database versus locks and concurrent data structures?

I'm presently focusing on a credit card applicatoin which has many (possibly remote) shows that collect live data from multiple data sources and renders them on the watch's screen instantly. Among the other designers have recommended using an in memory database rather than doing the work the conventional way our others reacts, which would be to use concurrent hashmaps, queues, arrays, along with other objects to keep the graphical objects and handling them securely with locks if required. His argument would be that the DB will lessen the necessity to be worried about concurrency because it will handle read/write locks instantly, as well as the DB will offer you an simpler method to structure the information into as numerous tables once we need rather than getting create hashmaps of hashmaps of lists, etc and monitoring everything.

I don't cash DB experience myself and so i am asking fellow SO customers what encounters they've had and do you know the pros &lifier cons of placing the DB in to the system?

Well a significant disadvantage will be the mismatch between Java along with a DB. This is a large headache if you do not require it. It might be also a great deal reduced for rather easy access. However, the advantages could be transactions and persistence towards the file system just in case of the crash. Also, based on your requirements, it enables for querying in ways that could be difficult related to a normal Java data structure.

For something between, I'd have a look at Neo4j. It's a pure Java graph database. Which means that it's easily embeddable, handles concurrency and transactions, scales well, and doesn't have all the mismatch issues that relational DBs have.

Up-to-date In case your data structure is straightforward enough - a roadmap of lists, map of maps, something of that nature, you are able to most likely pull off either the concurrent collections within the JDK or Google Collections, but much beyond that, and you'll likely end up re-creating an in memory database. And when your query constraints are even remotely difficult, you are going to need to implement all individuals facilities yourself. After which you will need to make certain they work at the same time etc. If the requires any serious complexity or scale(large datasets), I'd certainly not roll your personal unless of course you want to invest in it.

Should you choose made the decision to choose an embedded DB you will find a number of options. You might like to begin by thinking about whether you need to go the SQL or even the NoSQL route. Unless of course the thing is real good things about go SQL, It would also greatly increase the complexity of the application. Hibernate is most likely your simplest route using the least actual SQL, nevertheless its still type of headaches. I have tried it with Derby without serious issues, but it is still not straightforward. You could attempt db4o that is an item database that may be embedded and does not require mapping. This is a great overview. Like I'd stated before, whether it were me basically may likely try Neo4j, but that might just be me attempting to have fun with new and shiny things ) I simply see it a really transparent library which makes sense. Hibernate/SQL and db4o just appears like an excessive amount of hands waving to feel lightweight.

You could utilize something similar to Space4J and obtain the advantages of both a collections like interface as well as an in memory database. In practical use something as fundamental like a Collection is an in memory database without any index. A Listing is an in memory database having a single int index. A Roadmap is an in memory database having a single index type T based index with no concurrency unless of course synchronized or perhaps a java.util.concurrency.* implementation.