Page MenuHomePhabricator

Add key on "epoch" to Multimeter event table
Needs ReviewPublic

Authored by epriestley on Wed, May 27, 1:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jun 16, 3:36 PM
Unknown Object (File)
Wed, Jun 3, 7:37 PM
Unknown Object (File)
Wed, Jun 3, 7:03 PM
Unknown Object (File)
Tue, Jun 2, 4:22 AM
Unknown Object (File)
Sat, May 30, 1:12 PM
Unknown Object (File)
Sat, May 30, 9:42 AM
Unknown Object (File)
Sat, May 30, 8:11 AM
Unknown Object (File)
Thu, May 28, 8:41 PM
Subscribers
None
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

When loading a view of all event types in Multimeter, the existing "(eventType, epoch)" key may not be useful.

After bringing secure back online, I identified a crawler scraping Multimeter and causing this query to issue:

SELECT *,
  count(*) AS N,
  SUM(sampleRate * resourceCost) AS totalCost,
  SUM(sampleRate * resourceCost) / SUM(sampleRate) AS averageCost
FROM `multimeter_event`
WHERE (epoch >= 1779800130 AND epoch <= 1779886530)
GROUP BY `eventType`
ORDER BY totalCost DESC, MAX(id) DESC
LIMIT 100;

This took 30+ seconds to resolve. This is partly because the GC for this table hasn't run in a while and the sample rate on this host is very high, but adding the epoch key made the query instantaneous.

(I also restricted Multimeter access to logged-in users.)

Test Plan

Static checks only, still bootstrapping secure and my local environment.

Diff Detail

Repository
rP Phabricator
Branch
mm1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 25840
Build 35668: arc lint + arc unit

Event Timeline

epriestley created this revision.