StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.84k stars 1.5k forks source link

How to optimize array allocate when `StringGet`? #2745

Closed dameng324 closed 1 week ago

dameng324 commented 1 week ago

My program fetches a lot of data from Redis during startup. Each value is a byte array, which is deserialized immediately and the byte array is never used again after deserialization. This results in a significant number of byte arrays being allocated, causing high GC pressure.

Can I configure an array pool to reduce this problem when using StringGet?

mgravell commented 1 week ago

StringGetLease; dispose the result when you're done with the payload.

dameng324 commented 1 week ago

@mgravell Thanks a lot.I will try it.