A list of puns related to "Jettying"
This is an awfully niche question which may have no answer but I'm wondering why the architectural technique of jettying (the medieval habit of upper floors overhanging the first) wasn't seen outside of Europe. I understand the building taxes that went by ground coverage were unique to Europe but there are also structural advantages to jettying, you can rest a large wooden building on a small stone first floor, so I don't see why the technique didn't spread elsewhere.
I'm trying to properly understand ring's async support in combination with Jetty. We're using it with ring-jetty-adapter
, and are starting the server with :async? true
, so all our handlers have arity [request response raise]
, where response
and raise
are functions. We're doing this because some of our requests can be quite long-running, and we need to make a blocking I/O call to get the response data.
The thing is, Jetty JMX metrics are showing us that long-running requests are still holding onto one of the threads from Jetty's threadpool while in progress, so during a load test we hit in-progress requests = threadpool max, the thread queue size spikes, and we see healthcheck requests start timing out (we think due to being stuck in the queue), even though they have no blocking calls etc to slow things down. I thought the whole point of async here was that that didn't happen.
I've found various overly-simplistic examples detailing Jetty async (e.g. https://www.baeldung.com/jetty-embedded and https://webtide.com/servlet-3-1-async-io-and-jetty/), which show setting up a WriteListener
with onWritePossible
method, but they just use 'content' to write as a string buffer or similar, not a blocking I/O call like we have. They seem to be examples to prevent blocking when you have more data than the response servlet can accept in one go, rather than when you need to block to get that data in the first place. I also can't find any equivalent to that within ring.
I was expecting something that (for example) spawned a future
to run handler
within and used the response of that future to write the servlet response, but from https://github.com/ring-clojure/ring/blob/1.6/ring-jetty-adapter/src/ring/adapter/jetty.clj#L29-L41 it looks like any work we do in handler
to get the data and build the response-map will just block the servlet thread.
Are we supposed to be doing work ourselves within our handler to create a future
and build the response within it, then servlet/update-servlet-response
will make sure that is correctly sent to the output stream of the original request, and the Jetty thread is free to 'handle' another request? If so, is core.async/thread
a good thing to look at for this so that we can process the response from a channel (I know go
is not, because of its use of a small threadpool, so blocking I/O is a no-no), or are we better off with plain old future
?
Im wanting to take my 2 teenage daughters fishing and was wondering if someone could suggest a jetty or bank where we might get a bream or 2 or whatever really. Happy to drive as far north as Caloundra and as south as the Tweed. TIAβ
Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.