Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Everything You Wanted to Know About Overflow, Expiration and Eviction

246 vues

Publié le

SpringOne Platform 2018
Everything You Wanted to Know About Overflow, Expiration and Eviction
Barbara Pruijn, Karen Miller, Nick Vallely, Pivotal

Publié dans : Logiciels
  • Soyez le premier à commenter

  • Soyez le premier à aimer ceci

Everything You Wanted to Know About Overflow, Expiration and Eviction

  1. 1. Everything You Wanted to Know About Overflow, Expiration and Eviction Karen Miller and Barbara Pruijn September 2018
  2. 2. What We'll Cover 1. Expiration 2. Eviction (and Overflow)
  3. 3. Expiration is time based. Expiration
  4. 4. Shopping cart expires after 30 minutes Expiration - Why/When is it used?
  5. 5. ● Authentication: token expiration (session timeout) ● Finance: trade limit order, market data for risk calculations ● Insurance quote valid for one day ● Travel reservation: book before hold expires ● Cache to original data store Expiration - Why/When is it used? Application Cache DB
  6. 6. ● Expiration duration ● Expiration actions (invalidate, destroy) Expiration - What is it?
  7. 7. ● Expiration Types: ○ Time to live (TTL) ■ Entry is not written (put) for x time (read does not extend life). When entry is written, last modified timestamp is updated. ○ Idle timeout ■ When entry is read (get), last accessed timestamp is updated. (only local region) ■ A write (put) also updates the last accessed timestamp, but it does do this on all regions for a write. Expiration - What is it?
  8. 8. Create a region: • statistics-enabled on the region • the type of expiration and duration • the action for expiration Expiration - How is it used?
  9. 9. Time To Live example: gfsh> create region --name=region_ttl --type=REPLICATE --enable-statistics --entry-time-to-live-expiration=60 --entry-time-to-live-expiration-action=INVALIDATE Idle time example: gfsh> create region --name=region_idle --type=REPLICATE --enable-statistics --entry-idle-time-expiration=60 --entry-idle-time-expiration-action=DESTROY Expiration - gfsh examples
  10. 10. ● No fixed time expiration. If you write (TTL) or read (Idle) to an entry, you reset the timestamp. ● Geode transactions disable expiration on the entries participating in the transaction to avoid conflicts during the commit. ● Only one thread per JVM doing the expiration checks in the background (the scheduler). ● Don’t expire a million entries at once. Expiration - Things to know
  11. 11. Example on github: https://github.com/apache/geode-examples/tree/master/expiration Video: https://www.youtube.com/watch?v=BVzL3U_alXE Spring expiration example: https://docs.spring.io/spring- data/gemfire/docs/2.0.9.RELEASE/reference/html/#bootstrap-annotation- config-region-expiration Expiration - Resources
  12. 12. Heap memory management based on quantity of memory. Eviction
  13. 13. Heap memory accesses: fast Disk accesses: slow Garbage collection (GC): worst case, not just slow, but stopped. . . Motivation: performance
  14. 14. So, for performance, we want all region data to fit into heap space. Eviction keeps heap space usage (for region entries) within limits by getting rid of not-as-recently-used entries.
  15. 15. Eviction keeps heap space usage below a configured threshold. GC
  16. 16. 1. percentage of available heap 2. absolute quantity of heap space used 3. quantity of entries 3 Eviction Thresholds
  17. 17. Threshold 1: percentage of available heap space server heap space 75% threshold
  18. 18. Threshold 2: absolute quantity of heap space used server heap space 2 Gbyte threshold
  19. 19. Threshold 3: quantity of entries server heap space
  20. 20. 1. overflow to disk 2. local destroy 2 Eviction Actions
  21. 21. The key stays in memory, and the value overflows to disk. Eviction Action: Overflow to Disk key1 value1 key2 value2 key3 value3
  22. 22. Removes the entry from the local cache. Any redundant copies remain. → inconsistent entries across the region Eviction Action: Local Destroy
  23. 23. Threshold: percentage of heap space Eviction action: overflow to disk Start servers with the threshold specification: gfsh>start server --name=s1 --eviction-heap-percentage=80 Create the region with the action specification: gfsh>create region --name=r1 --type=PARTITION --eviction-action=overflow-to-disk Configure Eviction
  24. 24. Threshold: quantity of heap space used for region Eviction action: overflow to disk Create the region with the threshold and the action specification: gfsh>create region --name=r2 --type=PARTITION --eviction-max-memory=1000 --eviction-action=overflow-to-disk Configure Eviction units are in Mbytes
  25. 25. Threshold: quantity of entries Eviction action: overflow to disk Create the region with the action specification: gfsh>create region --name=r3 --type=PARTITION --eviction-action=overflow-to-disk --eviction-entry-count=80000 Configure Eviction
  26. 26. QUESTIONS?

×