-
Notifications
You must be signed in to change notification settings - Fork 658
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
Monitoring tags consumes more Redis RAM than expected #1314
Comments
Hi @benholmen. Thanks for reporting this. Which exact key would we also target with this trim? |
@benholmen have you had time to look at my question above? |
Dries - I have, I am working on a small PR to demonstrate it. I'll submit it shortly. |
For anyone with a similar issue, @taylorotwell has clarified that the intended use case for monitoring is short term, not permanent monitoring (see #1317). If you do monitor a tag indefinitely, your Redis memory consumption will grow over time. You can manually trim those monitored tags using a redis command like the following:
This would completely empty the redis key. You can also use timestamps to limit the range:
To identify large redis keys that may need to be trimmed, you can use the redis-cli --bigkeys
redis-cli --memkeys |
I am currently facing a memory overflow issue. I checked the large keys in Redis and discovered the following problems. How should I handle this? Key Data Type Encoding Memory Usage (Bytes) Number of Elements Max Element Length Average Element Length Expiration Timestamp Horizon Version Laravel Version |
Horizon Version
5.20.0
Laravel Version
10.22.0
PHP Version
8.2.9
Redis Driver
PhpRedis
Redis Version
Predis 2.2.1
Database Driver & Version
No response
Description
We ran into out of memory issues with Redis and after investigation found that several zsets were unusally large:
Those correspond to a
media-import
tag that we are monitoring in Horizon. The oldest score/timestamp in that zset was 7 months old, which is much older than we expected.Our Horizon config includes the following
trim
settings:I did some source diving and found
RedisJobRepository@trimMonitoredJobs
that seems to intend to clean this up usingconfig('horizon.trim.monitored')
but it only works on themonitored_jobs
key.Is it up to us to trim these monitored jobs or is there a Horizon method we can use to keep them from growing over time and consuming so much RAM?
Thanks so much!
Steps To Reproduce
The text was updated successfully, but these errors were encountered: