Every Server Running App Uses AppSignal ส่ง Collection of Samples และ Metrics to Push API Every 30 Seconds
Each Request Has Key We Use Determine Which App Data Came From To Do That We Need Query Database Find App for Each Incoming Request With Thirty Billion Requests Per Month We're Constantly Trying Find Ways Reduce Queries Make AppSignal Faster
เรา Implement Caching Reduce Queries on Database Clusters Whenever Fetch App from Database Store in Memcached One Minute After Deploying Change Production Found We Were Doing More Queries Than Before Seemed Like Cache Invalidated Too Often To Find Out Where That Happened We Added Custom Metrics Find Out Where Cache Improperly Invalidated
Couple Places Invalidate Cache เช่น When Push Processed Time Updated หรือ When Detect New Namespace
เรา Add Multiple Counters Determine Which Cache Invalidation Culprit Example Increment app.cache.invalidate Counter Count Total Validations และ Use Specific Keys app.cache.invalidate_push_time และ app.cache.invalidate_namespaces Specific Invalidations
Adding Custom Metrics Above Graph Cache Hits Over Time Immediately Apparent Which Cache Key Caused Rise in Queries app.cache.invalidate_namespaces Key Invalidated for Each Request

Total Number of Cacheable Requests Counted as app.cache.maybe.
After Deploying Fix for This Issue Number of Invalidations Dropped to Zero As Long As Namespaces for App Weren't Updated

Adding Custom Metrics Makes Easier Understand What's Happening Where When และ How Often In This Case Knowing Number of Cache Invalidations และ Showing Readable Graph Allowed Quickly Find Issue Just Needs Couple Lines of Code Increment Certain Value และ Create Dashboard
Let Us Know If Questions About Custom Metrics And If We Can Help Get Them Set Up in Your Application We're Happy to Help!
Robert Beekman
As Co-founder Robert Wrote Very First Commit He's Also Support Role-model Knows Tiny Details in Code Travels and Photographs (at the Same Time)
บทความทั้งหมดโดย Robert Beekman