Cutelyst 2.7.0 released, async is back!

Cutelyst a Qt/C++ Web Framework just got a new version. This time bringing back proper async support.

Perl Catalyst Framework was conceived as a sync/blocking framework, due that the Mojolicious framework was created, NodeJS and a few other web frameworks have pushed the async programming to the web. Performance wise being async doesn’t mean you get faster response times, rather the opposite, the need to unroll stack and make extra calls makes a CPU bound application slower.

But depending on the problem to solve it allows you to serve more users at the same time, using the same CPU cores. A typical modern application might receive a request from a Phone App then do a REST API call to an external API which might take 2ms or 200ms for the reply. While waiting for the response, typical sync/blocking applications can’t process more requests, or have to spawn more threads increasing RAM consumption and leveraging concurrency to the OS scheduler. On an Async web application, you can process another request while you wait for the previous request, thus possibly making the first request reply to be sent back to the user at a later time than is there was a dedicated process just waiting for his reply.

So, both ways have pros and cons and IMHO I’d like to support them both. When I started Cutelyst I thought that if I ever need async I could have a local QEventLoop to wait for the reply and would be able to deal with async requests, not recently I found out that supporting QEventLoop was causing stack overflow due it being used in pipelined scenarios, after that I removed it’s usage and performance improved in PlainText tests of TechEmpower, so I advised against using it and marked Cutelyst as not async.

Recently I got the need to call a few APIs from a REST API I did with Cutelyst, QNeworkAccessManager is an async only API, so either I create a thread for it to mimic sync behavior or allow Cutelyst to be used in async mode, of course I did the latter. The Context class has now detachAsync() and attachAsync() methods.

When you c->detachAsync(), you tell the engine to not send the headers and body immediately to the client, this will also break the action chain, meaning an end() method won’t be called, then when you get your async reply you call c->attachAsync().

Once c->attachAsync() is called the action chain is resumed so the end() method that possibly would render the HTML can perform it’s job.

It’s important to always be child ( QObject->setParent(…) ) of the Context pointer as if the client closes the connection it might be deleted.

This release was not only made of async:

A helper UserAgent singleton was added so that you have a thread_local QNetworkAccessManager with static methods to do more common REST tasks like sending a QJsonObject (yes, eventually I find time to write a patch for QNAM)

A new Sql::Transaction class gives you a scoped SQL transaction, preventing the mistake of not rolling back when you leave the scope in case of an error.

A few Headers helpers like ETag and If-Match comparison

Sebastian Held added support for dealing with Front-End Proxy Headers

Improved Stats precision using QElapsedTimer::nsecsElapsed()

And finally Cutelyst is not “half modern” CMake anymore, if that can even exist. The include directories of the exported Targets are now properly exported, so that you can remove:

04.08.2008 World Wine News Issue 350WWN Issue 350 was released today. News: Wine 1.1.2 CUDA Followup: it works! MSI Extensions Blitting speedups Digital Signature Checking in WINE AcceptEX Implementation More Issues...30.09.2008 VM streaming and VMware Workstation 6.5 -- now releasedI saw this demoed a while back and didn't realize it was in the newest Workstation, as I have become a Mactard who uses my VMware Fusion to run Windows on the Mac. But here it is in all its...28.08.2008 World Wine News Issue 351WWN Issue 351 was released today. News: Wine 1.1.3, gOS bundling 1.0, Wine Popularity The PatchWatcher DiB Engine Status Kernel bug inhibiting force feedback Wine Development Guide Spore and Wine Summer of code wrap up Google's Lively Unreliable Conformance Tests Weekly AppDB/BugZilla Status Changes More Issues...23.09.2008 World Wine News Issue 352WWN Issue 352 was released today. News: Progress towards 1.2 WineConf 2008 Coming Up Codeweavers Chromium Coverity Run Running Linux Apps from within a Wine App Weekly AppDB/BugZilla Status Changes More Issues...07.10.2008 World Wine News Issue 353WWN Issue 353 was released today. News: WineConf 2008 WineConf 2008 Keynote Focusing on the Users Wine's Image: WineHQ.org Wine on other platforms (Solaris, BSD, OS X) Wine 1.2 Timeline Updates on The Big Tickets: Quartz, WineD3D, iPod Support, DIB Engine Weekly AppDB/BugZilla Status Changes More Issues...25.02.2011 Top 5 Planet V12N blog posts for week 8 Top 5 Planet V12N blog posts for week 8 Big announcements over the past 24 hours, VMware View 4.6 is released along with VMware Thinapp 4.6.1. Congrats to both teams for all the hard work that went into getting these major updates out the door to our customers. The long awaited PCoIP security server is now available for View, and we now get much more support for Microsoft Office 2010 with Thinapp 4.6.1. Here are the top picks for week 8, happy surfing. Eric Horschman - Hypervisor Memory Management Done Right - Sophisticated and effective memory management has always been a key s...11.03.2011 Top 5 Planet V12N blog posts for week 10 Top 5 Planet V12N blog posts for week 10 I have added more feeds to the V12N blog aggregator, so there is even more great content coming in now. If you feel there is a blog site that should be part of the Planet V12N please let me know. We want to make sure we are getting as much quality content as possible showing up for everyone. This week we had some major announcements with vCenter Operations being launched, an acquisition announced of Wavemaker (Spring), and who could possibly have missed the VMware View iPad client? Don’t forget, VMworld 2011 call for papers was anno...07.05.2011 Top 5 Planet V12N blog posts for week 18 Top 5 Planet V12N blog posts for week 18 The VMware community is a unique social community with lots of collaboration, and people consistently trying to help each other out. I think this makes this social circle more unique than some other social media circles out there. For example check out the first blog post by Jason Boche, he has offered up his own lab infrastructure and bandwidth for anyone to test the VMware View iPad client. Very cool! A couple of people have asked me how do I select the 5 blog posts for the week. Giving back to the community is one of the qu...12.05.2010 Surveying Virtualization Performance Trends with VMmark Surveying Virtualization Performance Trends with VMmark The trends in published VMmark scores are an ideal illustration of the historical long-term performance gains for virtualized platforms. We began work on what would become VMmark 1.0 almost five years ago. At the time, ESX 2.5 was the state-of-the-art hypervisor. Today’s standard features such as DRS, DPM, and Storage VMotion were in various prototype and development stages. Processors like the Intel Pentium4 5xx series (Prescott) or the single-core AMD 2yy-series Opterons were the high-end CPUs of choice. Second-generation hardware-...22.09.2010 VMworld 2010 Online Sessions & Labs VMworld 2010 Online Sessions & Labs The VMworld 2010 (San Francisco) collection of session & lab videos, PDFs and MP3s has been released on VMworld.com for viewing in the Virtual Theater. General/Super Sessions are free for public viewing, but all other sessions and labs require that you either were a paid attendee from the VMworld 2010 San Francisco conference or purchased a VMworld 2010 Subscription. Note: VMworld Europe 2010 paid attendees will be granted access immediately after VMworld in Copenhagen. Visit the VMworld Sessions & Labs Theater Whether for fun or education...