I am building a Spring boot REST API app that is part of a microservice architecture project. What I am planning:

 - My app listens for events from two other services and after some business logic, logging, calculating, and persistence I have to publish my results to another rabbit MQ exchange. 
 - The first two services listen to pings every 10 seconds from 15,000 devices each and publish their data to queues that I listen to.

My current plan:

 - I need some sort of cache to keep track of events sent from both services because I need data from both at a time interval to do my logic. I am using an in-memory hashtable and I am sorting the values in this hashtable everytime I update it.

 - My hashmap is a ```Map<String, Map<String, Instant>>``` where the first key is a regionID and the second map is keyed based on deviceID. This sorting is done on the internal map and I suspect might become the bottleneck.

Is a single shared key value datastructure storage a good way to go with this or is there something else I should try?