(Java) Keep a huge collection of objects with indexed attributes

I need to store about 100 thousand objects representing users. These users have a username, age, gender, city and country.

Users should be available for searching by age and any other attributes, but also by a combination of attributes (for example, women from 30 to 35 from Brussels). Results should be found quickly, as this is one of the server services for many connected Clients). Users can be deleted or added, but not updated.

I was thinking of a fast database with indexed attributes (e.g. h2 db, which seems pretty fast, and I saw that they have a mode in memory)

I was wondering if any other option is possible before moving on to the database.

Thanks for any ideas!

+3
source share
4 answers

How much memory does your server have? How much memory will these objects occupy? Is it possible to save them in memory or not? Do you really need to speed up storage in memory as well as formatting the database? This makes it more difficult to store in memory, and it increases hardware requirements ... are you sure you need it?

Because everything that you described can be run on a very simple server and inserted into a very simple database and give the results you need in the amount of 100 ms per request. Need faster than 100ms response time? What for?

+2

RDBMS - ORM, Hibernate, POJO . , , .

H2. , / .

+2

. -, - , Sqlite. . - , . - , MySQL PostgreSQL, google . SQL- ( , ), . bwawok, , , .

+1

, ​​ EHCache Memcached? , , , TreeMap, , HashMap ( ). , . . .

0

Source: https://habr.com/ru/post/1756443/


All Articles