New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redisson RMap get response is slow #1193
Comments
Can you show us your log from the code you provided? |
response time in 4 milliseconds is acceptable in your case. But I'm afraid it would be impossible to get response time in 446ns as you expect, because LinkedHashMap will always work faster than any network based in-memory solution. |
Here is the console output |
Is it possible to find out what % of time is spent in object deserialization vs fetch from the mapo. Wanted to check if using alternate serialization could improve the performance, In our application cache is used heavily so even in small increment in response time is adding up considerably in overall response time. |
You can try the |
In that scenario, my application JVM should be able to handle all cached data - is this understanding correct? One of the reasons we're attempting to migrate from our home grown cache framework to Redisson/Redis is that we have large volume of data that needs to be cached and if it needs to be residing in application JVM, the application may slow down during garbage collection with increased heap size. |
The RLocalCachedMap can be used to only cache some hot entries while leave the colder ones in Redis. |
Thanks for the response. I modified my tester program to read/write against RLocalCachedMap but don't see my of the performance gain. Here are the console output I also notice that the keys are being populated on Redis as well. Should data put into RLocalCachedMap be going to Redis server? |
It's because the data you requested is not cached locally. It a problem of a cache miss.
It does. And also keeps some/all locally depending on your config |
Thanks again for your response. I've attached my sample program here. Could you please help me with appropriate config values. |
I did some more iteration of test program by using RLocalCacheMap and RMap. Here are the findings. |
I think you have misunderstood how
Looking at your code: the producer is:
and the consumer is:
This shows the cache-miss rate is 100% which is the worst possible case. If you only have 20 items in the map, and you only ever going to need each of them exactly once, there is no point use a local cache or near cache, however if you need to access some of them more than once, you will see the benefit. Try the following code you should see the difference:
|
Thanks for your response. The number 20 is arbitrarily chosen for this tester program. Inside application this number is running into 200000 to 500000 depending upon the environment. There are different kind of objects going into the cache and each object type goes into its own cache. Our LinkedHashMap based solution works fine with smaller data set but with increasing data , we're looking for something that doesn't impact application heap and hence garbage collection. Redis and Redisson was our obvious choice as we wanted to have our data residing in Redis and application works against that. Looks like with network traffic and serialization/deserialization of objects, it may not be most suitable for this particular application. |
The thing is a local cache / near cache and LinkedHashMap are in comparable in many ways: LinkedHashMap is not thread-safe, it doesn't scale well, it can't be consistent across nodes. I think you have run into some of these issues before hence the looking around. On the other hand the distributed local cache / near cache, the And I see you are also particularly interested in having a low latency while planning to keeping all the data in Redis. I think you might be interested in the Redisson PRO version. Redisson PRO is the enterprise version built on top of all the OS features. In addition it has a high performance engine as well as extra useful data types for enterprise environment. Based on our simple benchmark, we have observed 190k to 230k ops over the wire while the latency is within 1 ms. |
Hi @jackygurui - thanks for the response. As far as thread safety and synchronization is concerned, our LinkedHashMap based cache is handling it reasonably well using proprietary technology. And since all the nodes are caching java objects, time is not spent in serialization/de serialization. Having said that, we are interested in Redis based implementation to utilize other features of this framework including distributed cache thereby eliminating the need to continuously increase the heap of each of the nodes as data size increases. |
@shashibsingh No problem, I will have @mrniko to fast track the request for you. |
I got the license - thanks so much. Could you please point me to the jar file for pro. I'm getting following exception when introducing "registrationKey" in JSON config file |
@shashibsingh Please use the sales@redisson.pro email address for fast tracked enterprise support. |
@shashibsingh Please make sure that you don't mix os version with pro in classpath. |
Thanks. That issue got resolved. |
This is a question should really be translated into: Should I use a local cache / near cache (LC/NC) or not? To consider if you want to use the LC/NC, there are a few questions should be asked:
If your answer to all of above are yes then you should be using |
Thanks. My answer is 1 - Yes, 2 - Yes, 3- No. Based on your response I think I should stick with RMap. |
OK, great! In which case the Redisson PRO is perfect for speed up the |
I'm running the tests on my windows desktop. Will move the code to Linux and re run the test. Can I use this trial license on Window and Linux simultaneously or it is one connection at a time? Thx |
you can run it on both platforms at the same time, but with Linux you can enable the |
great - let me check with my admin regarding epoll. Do you have any suggestion regarding map.put , map. fastPut and map.fastPutIfAbsent. In majority of the cases, we don't care about the previous value associated with a key. |
|
good to know that - I guess I can try using async methods for put and see if that gets me some boost. |
Be extra careful with async methods, since the nature of async, you will end up having a lot more future objects which can be a pain to the GC if it is not controlled. i.e. a for loop produces a million async calls might not be a good idea. Especially if the Redis side is not catching up with the demand, that would make some of those future objects live across a few GC generations which would require you to tweak JVM's GC params in order to get rid of them effectively. Why not try the synced methods first and see the result, it should serve you as a guidance of what the PRO engine can do. Also try it against some real world use case, it is often to everyone's surprise that the PRO engine actually works better under load. It is tuned to be (nearly) linearly scaleable to a few hundreds of concurrent thread. |
Thanks for the suggestion - would you please point me to any documentation regarding epoll that you mentioned earlier. For me to be able to contact right admin, I must have little bit of background. |
Never mind - I think you're referring to https://en.wikipedia.org/wiki/Epoll |
You mean the technical documentation for epoll? or the configuration document to have redisson use epoll? |
I see you have found what you are looking for. |
Hi @jackygurui |
and just to be sure - this parameter needs to be changed on the server where Redis is installed not the app server of the application - correct? |
do we need to make any change in following config property |
@shashibsingh I'll try to answer. To start using epoll with Redisson you should set |
Hi @mrniko & @jackygurui Caused by: java.lang.NoSuchFieldError: ACCEPT_CASE_INSENSITIVE_PROPERTIES |
It seems that you use different version of jackson lib in deployment environment. Please check classpath |
Hi there |
@shashibsingh I am sorry you have not seen any differences in your use case with the PRO version, have you contacted @mrniko with your benchmark perhaps he can help you address the issues you are facing. As to your another question, there is a config option called |
Hi @jackygurui Thanks for your response. I'll be contacting @mrniko with statistics. What I'm seeing is that with PRO, the application is reasonably fast 2nd login onwards with smaller DB. However, with production equivalent DB, it is slows down considerably. Wondering if I'm missing something in the implementation. |
Hi @jackygurui & @mrniko - Could you please point me to documentation for the following |
@shashibsingh Hi! All available documentation is on wiki page - https://github.com/redisson/redisson/wiki/7.-distributed-collections#714-map-data-partitioning
|
@mrniko Thanks for the response. After switching to RMapCache and increasing the cache size, I'm seeing the better performance. For comparison purpose, with RMap, to look-up a single key and return the associated java objets it is taking 1+ min whereas with RLocalCachedMap, it is taking 280 ms. With this behavior, got some questions and appreciate your response
|
It seems you have very slow test and/or Redis instance. Below are answers to your questions:
|
I've a java application where I'm using Rmap to store and retrieve objects to/from Redis. The response time of map.put(...) is reasonable but map.get(...) is averaging 4000000.0 ns. I'm using FstCodec for serialization/deserialization. The application has many classes that do not provide no arg constructor and hence certain codecs can't be used.
I would like to know how to improve the map.get(...) response. When same object to go LinkedHashMap, the response time is in the range of 446.0 ns and I'm looking for a response time in that range.
Find attached my sample java application and config file.
RedissonIPWCTaskTester.java.txt
RedisConfig.json.txt
The text was updated successfully, but these errors were encountered: