A248

An Expiration Event - Reliability and Database Performance

Mar 22nd, 2022
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. Punishments are cleaned up periodically in the background, by a database query which deletes expired punishments. Let's say that we fired expiration events when this happened. Well, then, you would receive expiration events every 3 hours, since the hard-coded interval is 3 hours. Your plugin, therefore, would send batches of messages to discord at once; it would be quite unrealistic, and users would wonder why they receive many messages at specific times, but no messages at other times.
  2.  
  3. But you might wonder: why not shorten the periodic interval? Let's say we set the interval for clearing expired punishments to 30 seconds. Well, this would improve the accuracy of expiration events, but it would introduce a performance problem. On multi-proxy installations where multiple instance of LibertyBans exist, you might have dozens or hundreds of LibertyBans instances. This implies a significant database burden.
  4.  
  5. Let's say there are 100 instances. If all these instances make database queries every 30 seconds, that implies about 3 queries every second on average. This additional database load - 3 queries per second - is comparable to the database load of 3 players joining the network every second.
Advertisement
Add Comment
Please, Sign In to add comment