Search code examples
multithreadingjsfjsf-2.2fiberquasar

How do I get quasar fibers working optimally with JSF?


How do I get quasar working optimally with JSF? I created a JSF project with Comsat Quasar integration on the lines of FiberHttpServlet but do not see any improvement in numbers.

My project is here : https://github.com/sanketsw/Quasar_JSF_Demo

Unfortunately the Fibers were not found to have impacted any postively when tested from JMeter(server capped to 50 threads and JMeter test running 3000 users). The response was exactly same as javax.faces.webapp.FacesServlet upto 500 users. For 3000 users, the error rate of the requests failure was more and the response time was also significantly higher than normal FacesServlet for successful requests.

If you happen to work on this thread further and have any better results, let me know. Or please see if I am making any mistake in the configuration.


Solution

  • The benefit about using fibers to serve HTTP requests rather than threads is that you can have many more active fibers than threads with far less resources, so you're likely going to see improvements in increased concurrency rather than in average response time at low concurrency. If you run only 50 concurrent requests (that's what I understand from your description, couldn't find the benchmark scripts in the GitHub project) you can just use regular thread-based servlets with a thread pool size > 50 and probably you'll even get better latency (as you're not deferring requests completion and not using all the machinery needed to track that inside your servlet container, nor potential thread handovers with cache impacts etc).

    The benefit of fibers (as of async servlets or other async frameworks, which are much more cumbersome to program though) is that you're able to support many more concurrent requests, more than the threads that your box can support (say more than 15k), which usually means you are being hit with an extremely high request rate and/or your requests require substantial processing time. Please also note that usually such high rates require tuning of the OS network stack to allow more open file descriptors, faster connections turnaround etc.

    Also note that the recently released Comsat 0.6.0 improves servlet and web actors performance. Anyway Comsat servlets rely on servlet async functionality of the servlet container you run them on, so if that implementation is buggy or not very efficient this carries over to Comsat servlets too. I got good results with Undertow (just wait for the first request to complete before making the service available or you're going to get errors).

    Note: I'm part of the Parallel Universe team.