Cutelyst just got a new release!
Thanks to the release of Virtlyst - a web manager for virtual machines, several bugs were found and fixed in Cutelyst, the most important one in this release is the WebSockets implementation that broke due the addition of HTTP/2 to cutelyst-wsgi2.
Fixing this was quite interesting as when I fixed the issue the first time, it started to make deleteLater() calls on null objects which didn't crash but since Qt warn's you about that it was hurting performance. Then I fixed the deleteLater() calls and WebSockets broke again :) a little of gdb foo and I found out that when I asked for the websocket to close Qt was emitting disconnected as a result of that call, and that signal was deleting the object we rely when we called close, which crashed the app.
As a new feature Context class has two new methods to help with async apps, a wait() method that creates a counter based local event loop and a next() method to decrease the event loop counter till quitting it. This way you can for example connect two QNetworkReply::finished() signals to Context::next() and call Context::wait(2); so once the two requests are finished wait() returns and the client receives the data.
Codacy was also added to increase the number of checks in our code base, and it has already shown some real issues.
UPDATE: Right after release I found a cppcheck code fix broke listening on TCP sockets, yes, writing more unit tests especially for the WSGI module is top on my TODO list. So 2.2.1 is out now :)
Virtlyst is a web tool that allows you to manage virtual machines.
In essence it's a clone of webvirtmgr, but using Cutelyst as the backend, the reasoning behind this was that my father in law needs a server for his ASP app on a Win2k server, the server has only 4 GiB of RAM and after a week running webvirtmgr it was eating 300 MiB close to 10% of all available RAM. To get a VNC or SPICE tunnel it spawns websockify which on each new instance around 20 MiB of RAM get's used.
I found this unacceptable, a tool that is only going to be used once in a while, like if the win2k freezes or goes BSOD, CPU usage while higher didn't play a role on this.
Choosing a web interface for KVM/libvirt is no easy task, I have used Archipel and while it's a nice app it is a pain to install, OpenStack is also overly complicated, and had a button labeled as "Terminate" button that deleted the instance entirely. A simple tool that's specially simple to install was what I needed, and in fact is what a bunch of people need, here at work, OpenStack was also discarded due the hard installation process and a mix of virsh/virt-manager is used.
Since webvirtmgr is a DJango app, using it's html templates was a breeze, Grantlee didn't work with them out of the box, it has a few missing features but one can work around those, libvirt API is also quite well documented so development was quite fast, it took me 3 weeks but could easily be reduced to less than 2 if I had a bit more time.
So Virtlyst v1.0.0 is out, it uses less than 10MiB of RAM, and implements the VNC/SPICE web socket proxy in the same process thus each connections increases a almost nothing of memory usage. The software is already in production, and has all features of webvirtmgr except the migration part, that I plan to add in a future release.
Following the steps of some developer fellows I also created a Patreon account, so if you like what I do and would like to support my work please consider becoming a Patron.
Enough said, go get it!
Cutelyst a Qt/C++ Web Framework got upped to 2.1. Yesterday I found a bug that although not critical it's important enough to roll out a new release.
As a new feature we have LangSelect plugin to help with auto detection of user language (Matthias).
And some important bug fixes:
- Fix compilation with Qt 5.11
- clazy fixes
- Fix undefined cutelyst2_plugin symbol of uWSGI plugin
- Fix for IPv6 address binding
- Fix StoreHtpasswd::addUser if file doesn't exist (Bart)
- Fix parsing when the url encoded (on body or query) has a key without a value but carries the equal sign (?foo=&bar)
Cutelyst the Qt/C++ web framework just got a major release update, around one and half year ago Cutelyst v1 got the first release with a stable API/ABI, many improvements where made during this period but now it was time to clean up the mistakes and give room for new features.
Porting applications to v2 is mostly a breeze, since most API changes were done on the Engine class replacing 1 with 2 and recompiling should be enough on most cases, at least this was the case for CMlyst, Stickyst and my personal applications.
Due cleanup Cutelyst Core module got a size reduction, and WSGI module increased a bit due the new HTTP/2 parser. Windows MSVC was finally able to build and test all modules.
WSGI module now defaults to using our custom EPoll event loop (can be switched back to Qt's default one with an environment variable), this allows for a steady performance without degradation when an increased number of simultaneous connections is made.
Validators plugins by Matthias got their share of improvements and a new password quality validator was added, plus manual pages for the tools.
The HTTP/2 parser adds more value to our framework, it's binary nature makes it very easy to implement, in two days most of it was already working but HTTP/2 comes with a dependency, called HPACK which has it's own RFC. HPACK is the header compression mechanism created for HTTP/2 because gzip compression as used in SPDY had security issues when on HTTPS called CRIME .
The problem is that HPACK is not very trivial to implement and it took many hours and made KCalc my best friend when converting hex to binary to decimal and what not...
Cutelyst HTTP/2 parser passes all tests of a tool named h2spec, using h2load it even showed more requests per second than HTTP/1 but it's complicated to benchmark this two different protocols specially with different load tools.
Upgrading from HTTP/1.1 is supported with a switch, as well as enabling H2 on HTTPS using the ALPN negotiation (which is the only option browsers support), H2C or HTTP/2 in clear text is also supported but it's only useful if the client can connect with previous knowledge.
I strongly recommend reading this https://jakearchibald.com/2017/h2-push-tougher-than-i-thought/ .
This does not mean SERVER_PUSH won't be implemented, quite the opposite, due the need to implement it properly I want more time to study the RFC and browsers behavior so that I can provide a good API.
I have also done some last minute performance improvements with the help of KDAB Hotspot/perf, and I must say that the days of profiling with weird/huge perf command line options are gone, awesome tool!
If you like it please give us a star on GitHub!
On Valentines day TechEmpower released the results of fifth round of it's benchmarks tests on web frameworks, it took almost a year since round 14 and I really hope round 16 comes out sooner.
Since this round took a long time and was scheduled to be release many times last year I decided not to update Cutelyst to avoid not having the chance to fix any issues and have broken results. Cutelyst 1.9.0 and Qt 5.9 were used, both had some performance improvements compared to round 14, and thus you can see better results on this round compared to 14, most notably the JSON tests went from 480k request/second to 611k req/s, also due this Cutelyst release used jemalloc was again not used due a bug we had in CMake files that didn't link against it.
In this round some other frameworks have also done their optimizations and a few managed to do better than Cutelyst, even though we were faster in all tests compared to the last round. It might be even related to some OS tuning as most results seemed to went up a bit, however if you put the filter on "FullStack" frameworks Cutelyst is leading in most tests.
TreeFrog framework had results in TechEmpower long before I wrote the tests for Cutelyst, but due errors on TreeFrog tests on last rounds this was the first round where you can compare the results of two Qt Web Frameworks.
For the next round I expect the results to be even better now that we will properly use jemalloc, and our epoll dispatcher got a better implementation, I also plan to use Cutelyst 2 and try increasing some buffers as the servers have plenty of RAM that I didn't care on using.