# I am the Watcher. I am your guide through this vast new twtiverse.
# 
# Usage:
#     https://watcher.sour.is/api/plain/users              View list of users and latest twt date.
#     https://watcher.sour.is/api/plain/twt                View all twts.
#     https://watcher.sour.is/api/plain/mentions?uri=:uri  View all mentions for uri.
#     https://watcher.sour.is/api/plain/conv/:hash         View all twts for a conversation subject.
# 
# Options:
#     uri     Filter to show a specific users twts.
#     offset  Start index for quey.
#     limit   Count of items to return (going back in time).
# 
# twt range = 1 10
# self = https://watcher.sour.is/conv/7yfkzjq
Problem 2: Your SSD-backed database has a usage-pattern that rewards you with a 80% page-cache hit-rate (i.e. 80% of disk reads are served directly out of memory instead of going to the SSD). The median is 50 distinct disk pages for a query to gather its query results (e.g. InnoDB pages in MySQL). What is the expected average query time from your database?

----

Share your solution via Twtxt and how you arrived at it and I'll share my solution tomorrow!

#napkin-math
Problem 2: Your SSD-backed database has a usage-pattern that rewards you with a 80% page-cache hit-rate (i.e. 80% of disk reads are served directly out of memory instead of going to the SSD). The median is 50 distinct disk pages for a query to gather its query results (e.g. InnoDB pages in MySQL). What is the expected average query time from your database?

----

Share your solution via Twtxt and how you arrived at it and I'll share my solution tomorrow!

#napkin-math
* Page size 1MB
* Median 50 pages per query
* 80% pages cached
* 200us SSD reads
* 100us Memory reads
* Query time:
* (50x0.80x100)+(50x0.20x200)‎ = 6,000
* 6000us
* 6ms*
* Page size 1MB
* Median 50 pages per query
* 80% pages cached
* 200us SSD reads
* 100us Memory reads
* Query time:
* (50x0.80x100)+(50x0.20x200)‎ = 6,000
* 6000us
* 6ms*
@prologic 6ms, so extremely slow! :-P
@bender are one of my assumptions off?
@bender are one of my assumptions off?
@prologic I wouldn’t know! :-)
@bender I reviewed my solution and it's pretty much spot on! 🤣 the order of magnitude performance is anywhere between 1-10ms
@bender I reviewed my solution and it's pretty much spot on! 🤣 the order of magnitude performance is anywhere between 1-10ms