@@ -0,0 +1,58 @@
2+title = "Eyre Request Cache"
6+grant_type = [ "Bounty" ]
7+grant_category = [ "Core Dev" ]
11+description = "Speed up Urbit http server by implementing a cache for requests"
18+link = "https://airtable.com/shr4qt9t9kz7RaOIa?prefillGrant+ID=&prefillGrant+Name=Eyre%20Request%20Cache"
24+Urbit is a personal server, but the webserving part of it is slow, which is a
25+problem for any use case that involves using your urbit as a regular webpage
26+server and handling requests at scale. However, it doesn't need to be slow. For
27+its HTTP I/O driver, Urbit uses a library called H2O, which is incredibly fast,
28+but unfortunately, Urbit cannot take advantage of that speed because every HTTP
29+request currently is routed through the slow Arvo event loop.
31+Since a large amount of HTTP requests are essentially just read requests, we can
32+treat many of them as cacheable scries, which would allow the Urbit runtime to
33+fulfill them without invoking the Arvo event loop.
35+This would enable Urbit users with large audiences to serve web pages to them
36+without worrying about making their Urbit slow and unusable. This would
37+eliminate the need for a pattern we've frequently seen of people putting an
38+nginx or caddy cache in front of their Urbit to mask its shortcomings.
40+This is one part of a two-part bounty. This part focuses on the changes to the
41+the Eyre API on the Arvo side, and the second part focuses on changes to the
42+runtime. This part can be merged into the Urbit codebase before the runtime
43+work, but the desired speedup will not occur until both parts are in.
47+Eyre will store a map from URLs to clay scry paths. HTTP requests coming in to
48+eyre will first check this map, and if it matches, scries the file out of clay
49+and returns it immediately. It if doesn't match, it just goes through the
50+current normal path for HTTP requests.
52+New %tasks will be created for eyre to add and remove from this map.
54+A %warp request to clay is maintained for each clay file in the map in order to
55+be notified about changes to them. When notified about said changes, Eyre will
56+give a %gift to the runtime.