I'm looking for advice about how to debug this. 

I wrote a small web app. It has about 1,200 lines of code. It is fairly 
standard for a Clojure app, it uses Jetty, and Compojure. It uses MongoDB.

I'm just working on my MacBook Pro right now, so there is no issue such as 
using Nginx or load balancers. 

I can start the app up, and reach it on port 8082, and see all of the pages.

However, this app does have a scheduled task that runs every 15 minutes and 
which is fairly demanding. It imports a large number of JSON files from an 
S3 bucket and stores them in MongoDB. 

This all works fine, but during the import, the app is no longer responsive 
on port 8082. The browser gets nothing back. 

My first thought was "I'm stupid because I've blocked the main thread, I've 
got too much going on." But then I thought "Wait, Jetty does not run on the 
main thread, so it shouldn't be effected by whatever I'm doing on the main 
thread." 

So now I'm thinking, I'm doing some database work on the main thread, and 
this keeps the Ring handlers from looking up information from the database, 
so there is perhaps some kind of timeout issue? Like, the handler tries to 
reach MongoDB, finds it unresponsive, and gives up after a certain amount 
of time? Or too many functions are sharing a single connection to MongoDB, 
so that is the problem.

I'm testing, in part, by moving all of the database calls to background 
threads, and giving each separate connections to MongoDB, but I'm also 
looking for advice about other problems I should look for. 



-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to