@@ -18,28 +18,53 @@ link = ""
19## Rationale
19## Rationale
21+Urbit is a personal server, but the webserving part of it is slow, which is a
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.
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.
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.
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.
27## Implementation
37## Implementation
29−### Vere
39+### Milestone 1: Eyre
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.
46+This behavior will then be mirrored in the runtime, so that the behavior is the
47+same regardless of runtime behavior.
49+New %tasks will be created for eyre to add and remove from this map.
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.
31−The machinery to peek arvo will need to be set up for use with Eyre, and a cache
59+The machinery to scry into arvo will need to be set up for use with Eyre, and a
32−will need to be configured for H2O.
60+simple cache 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,
61+
34−then scrying each file in that map out of clay. This allows us to have a
62+The cache will be filled/invalidated by the %gift pushed from Eyre, as specified
35−two-layered naming system, where nice human-made, mutable, and non-referentially
63+above. This gift contains a URL and the clay file correponding to it, which
36−transparent URL paths map to strict referentially transparent clay paths.
64+allows the runtime to just put that in the cache directly.
38Inbound GET requests should first try the cache, and if that fails, just invoke
66Inbound GET requests should first try the cache, and if that fails, just invoke
39eyre in the usual way. Cache misses should add negligible time to HTTP requests,
67eyre in the usual way. Cache misses should add negligible time to HTTP requests,
40and cache hits will be extremely fast.
68and cache hits will be extremely fast.
42−### Eyre
70+reward: 5 stars
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