@@ -18,28 +18,53 @@ link = ""
1818
1919## Rationale
2020
21−Urbit is a personal server, but the webserving part of it is slow, which is a problem for any use case that involves using your urbit as a regular webpage server and handling requests at scale.
21+Urbit is a personal server, but the webserving part of it is slow, which is a
22+problem for any use case that involves using your urbit as a regular webpage
23+server and handling requests at scale. However, it doesn't need to be slow. For
24+its HTTP I/O driver, Urbit uses a library called H2O, which is incredibly fast,
25+but unfortunately, Urbit cannot take advantage of that speed because every HTTP
26+request currently is routed through the slow Arvo event loop.
2227
23−However, it doesn't need to be slow. For its HTTP I/O driver, Urbit uses a library called H2O, which is incredibly fast, but unfortunately, Urbit cannot take advantage of that speed because every HTTP request currently is routed through the slow Arvo event loop.
28+Since a large amount of HTTP requests are essentially just read requests, we can
29+treat many of them as cacheable scries, which would allow the Urbit runtime to
30+fulfill them without invoking the Arvo event loop.
2431
25−Since a large amount of HTTP requests are essentially just read requests, we can treat many of them as cacheable scries, which would allow the Urbit runtime to fulfill them without invoking the Arvo event loop.
32+This would enable Urbit users with large audiences to serve web pages to them
33+without worrying about making their Urbit slow and unusable. This would
34+eliminate the need for a pattern we've frequently seen of people putting an
35+nginx or caddy cache in front of their Urbit to mask its shortcomings.
2636
2737## Implementation
2838
29−### Vere
39+### Milestone 1: Eyre
3040
31−The machinery to peek arvo will need to be set up for use with Eyre, and a cache
32−will need to be configured for H2O.
33−The cache will be filled by polling a scry path in eyre that maps urls to clay paths,
34−then scrying each file in that map out of clay. This allows us to have a
35−two-layered naming system, where nice human-made, mutable, and non-referentially
36−transparent URL paths map to strict referentially transparent clay paths.
41+Eyre will store a map from URLs to clay scry paths. HTTP requests coming in to
42+eyre will first check this map, and if it matches, scries the file out of clay
43+and returns it immediately. It if doesn't match, it just goes through the
44+current normal path for HTTP requests.
45+
46+This behavior will then be mirrored in the runtime, so that the behavior is the
47+same regardless of runtime behavior.
48+
49+New %tasks will be created for eyre to add and remove from this map.
50+
51+A %warp request to clay is maintained for each clay file in the map in order to
52+be notified about changes to them. When notified about said changes, Eyre will
53+give a %gift to the runtime.
54+
55+reward: 5 stars
56+
57+### Milestone 2: Vere
58+
59+The machinery to scry into arvo will need to be set up for use with Eyre, and a
60+simple cache will need to be configured for H2O.
61+
62+The cache will be filled/invalidated by the %gift pushed from Eyre, as specified
63+above. This gift contains a URL and the clay file correponding to it, which
64+allows the runtime to just put that in the cache directly.
3765
3866Inbound GET requests should first try the cache, and if that fails, just invoke
3967eyre in the usual way. Cache misses should add negligible time to HTTP requests,
4068and cache hits will be extremely fast.
4169
42−### Eyre
43−
44−Eyre will store a map from URLs to clay paths, and expose that map at a scry path.
45−New %tasks will be created for eyre to add and remove from this map
70+reward: 5 stars