summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2018-01-23 11:47:12 -0800
committerBen Sima <ben@bsima.me>2018-01-23 11:47:12 -0800
commitf7d7e33c5800580566dbbdda697952085bfdc5c2 (patch)
tree870414b091072866c9bcfcc750c1dd95f7c51b40
parent61e0beb53ab923a862a7e4938787eaa710e31f51 (diff)
More docs
-rwxr-xr-xmain.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/main.hs b/main.hs
index 5750c15..1d06dd8 100755
--- a/main.hs
+++ b/main.hs
@@ -240,15 +240,21 @@ postNumberR = do
caller <- liftIO $ update db $ AddCaller _name _number _context
sendStatusJSON status200 $ caller
--- | This takes a while; it's doing like 200 records per second. It's IO bound,
--- and in an un-optimized program GHC on Linux uses a single, blocking IO
--- manager thread (on Windows it's non-blocking, apparently). This can be
+-- | This takes a while; on my machine it averages 181 records per second. It's
+-- IO bound, and in an un-optimized program GHC on Linux uses a single, blocking
+-- IO manager thread (on Windows it's non-blocking, apparently). This can be
-- improved with the Control.Concurrent module, it which case we could launch as
--- many IO threads as we want, and do probably 10k records per second.
+-- many IO threads as we want, and do probably 10k records per second. There's
+-- definitely an optimal amount of threads here, we'd have to test to find that.
--
-- HOWEVER, you can watch it bootstrap. Hit this endpoint, then use "GET /count"
-- to see it updating. New POSTs will also work and update the database, even
-- while it is bootstrapping, which is kinda cool.
+--
+-- Try this in bash:
+--
+-- while sleep 1; do curl -s "localhost:3000/count" | jq '.count'; done
+--
postBootstrapR :: Handler RepJson
postBootstrapR = do
$logInfo "Initializing the database."