user2531191
user2531191

Reputation: 579

Caching / Mapping strategy for standalone java application

I have a SQL Table with disk size ~50 GB. The table is read-only and thus, ideal for caching. For faster and frequent look ups, what would be ideal -

  1. Java 8 Hash Map.
  2. Memcached.
  3. Hibernate EH Cache. or anything better ?

(provided 200 GB of main memory is available for JVM).

Upvotes: 1

Views: 547

Answers (2)

Louis Jacomet
Louis Jacomet

Reputation: 14500

Disclaimer: I work for Terracotta on Ehcache

Another option would be to use the upcoming Ehcache 3 with its offheap tier. This would allow you to cache the whole table in RAM but outside of the control of the GC, thus not being a source of pause times.

Upvotes: 0

frhack
frhack

Reputation: 5112

You can start trying Guava cache (Google Core Libraries for Java 1.6+)

Generally, the Guava caching utilities are applicable whenever:

  • You are willing to spend some memory to improve speed.
  • You expect that keys will sometimes get queried more than once.
  • Your cache will not need to store more data than what would fit in RAM. (Guava caches are local to a single run of your application.
    They do not store data in files, or on outside servers.

    If this does not fit your needs, consider a tool like Memcached.)

Upvotes: 1

Related Questions