Skip to content

This project should demonstrate an error which occurs when performing concurrent read and write redis operations.

Notifications You must be signed in to change notification settings

Josef-Reichardt/redis-concurrent-read-write-error

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

This project should demonstrate an error which occurs when performing concurrent read and write redis operations.

I looks like Spring or Redis or something in between can't read values while they are written by CrudRepository. The application behaves as if the value did not exist.

How to run?

Simply clone this git repository and run tests.

For example by running

mvn test

What's happened?

There two test classes and each one has two test methods:

  1. RepositoryControllerTest
    Using a CrudRepsoitory: ExampleRepository
    1. getWithoutIncreasingReadCounter
      Creates one entry in redis and reads it 100 times concurrently.
      This is working well.
    2. getAndIncreaseReadCounter Creates one entry in redis and reads it 100 times concurrently. For each request the value is modified and written back to redis.
      This is not working!
  2. TemplateControllerTest
    Using a RedisTemplate: TemplateExampleRepository
    1. getWithoutIncreasingReadCounter
      Creates one entry in redis and reads it 100 times concurrently.
      This is working well.
    2. getAndIncreaseReadCounter Creates one entry in redis and reads it 100 times concurrently. For each request the value is modified and written back to redis.
      This is working well.

Result

CrudRepository RedisTemplate
read 100 times concurrently: working working
read and write 100 times concurrently: NOT working working

About

This project should demonstrate an error which occurs when performing concurrent read and write redis operations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages