Daniel NicolettiBrazil, São Paulo http://dantti.wordpress.com 55 Posts
SimpleMail is a small Qt library for sending mails, this release makes sure it compiles fine with Qt6, and has some small issues fixed.
I thought this would give me a bit of work but was mostly changing CMakeLists.txt and including one header.
This week I'll start working for KDAB :) and my first task will be porting one app to Qt6, so I decided to do a little of homework and port my own stuff first as you might have noticed (Cutelyst and ASql).
Cutelyst a Qt Web Framework and ASql an asyncronous SQL library for Qt got new releases.
The Cutelyst version 2.14.0 was made in December but was a silent one, I had some issues in production but weren't related to Cutelyst, the .1 release included some contributions by Adriaan de Groot, I also did some changes for Qt 5.15 and Qt6 but for Qt6 a new major version is needed.
Besides a bunch of fixes, a major regression on the plaintext benchmarks got fixed, unfourtunately not in time for round 20, but thanks to ASql you will Cutelyst got a better scoring on SQL related benchmarks
ASql also got a bunch of bug fixes, but most importantly it's now Qt6 ready.
And speaking of Qt6 Cutelyst port is also completed now, after I port most of my own apps I'll do a v3 release which is compatible with both Qt5 and 6.
Cutelyst the C++/Qt Web Framework and ASql the ASync SQL library for Qt applications got new versions.
Thanks to the work on ASql Cutelyst got some significant performance improvements on async requests, as well as a new class called ASync, which automatically detaches the current request from the processing chain, and attaches later on when it goes out of scope.
With the ASync class you capture it on your ASql lambda and once the query result arrives and the lambda is freed and the ASync object gets out of scope and continues the processing action chain.
KDAB's fix on a 10 year old bug raised my attention back to a note on QTcpSocket documentation:
Note: TCP sockets cannot be opened in QIODevice::Unbuffered mode.
Which is actually wrong, according to the source code, Cutelyst has been using buffered mode since always due that, so hopefully this new version will be a bit faster and consume less memory, it's important to notice that once the Kernel tells it's going to block QTcpSocket writes get buffered anyway.
Now talking about ASql you might notice the jump on release versions, this is because I've been experimenting some changes and didn't want to write a post at each new feature.
ASql is now at the closest API I'd like it to be, unfortunately one of my goals that would be to be able to handle it's AResult object to Grantlee/Cutelee and be able to iterate over it's records just once, but the call QVariant::canConvert with QVariantList must succeed and the class be able to be casted to QAssociativeIterable or QSequentialIterable, which I didn't managed to get it working in a way I like.
But AResult has hash() and hashes() methods that convert the data to a format that can be used in templating.
On the plus side I added iterators (if you have experience with iterators please review my code as this was the first time I wrote this kind of code) that also work on for ranged loops, and they also have faster type conversion methods, instead converting the data to a QVariant type, and them using QVariant to get the data out of it, one can just call toInt() which will get the int straight from the result set without checking each time if it's an int.
Added AMigrations which is an awesome database maintenance class that is both simple and helpful to maintain database schemas.
- ACache class to cache special queries
- Support for data inside QJsonValue
- Single Row mode (the lambda get's called once per result)
- Prepared Queries
- Scoped Transaction class
- Notifications - this is my favorite PostgreSQL feature, it's hard to image some other big databases lack such an useful feature.
Oh, and Cutelyst results on TechEmpower already got better thanks to ASql, hoping to see even better results when I update the tests to 2.13 that has Unbuffered and faster async handlying.
Cutelyst a Qt web framework got a new version, this version has one important fix for async apps using FastCGI or HTTP2, also fixes for SO_REUSEPORT, and as a new feature is has support for listen queue backlog on UNIX, sadly QTcpServer doesn't support both of these (I need to find time to write some patches...).
Cutelyst is available for many Linux distributions but doesn't for Debian/Kubuntu, so I'm also adding the CPack deb built will all but uWSGI support for 20.04 amd64.
When developing Qt applications be it Desktop, Mobile or Web that need to talk directly with a database the use of QtSql is usually the best choice, it has many database drivers, comes ready on their installer, but has a blocking API, which means a query will block you GUI thread.
My Cutelyst Web projects also used QtSql, and for low traffic this isn't a big issue because you are not freezing users GUI, but you are freezing the request queue instead.
One of the Cutelyst apps I developed this year has a very high traffic, and a side effect of blocking came in play, I've about 3k TVs connected via websockets, once a TV connects it does an authentication query, it takes ~17ms, now when there is an event PostgreSQL notifies the application which does some 20 other queries a little more expensive (~30ms) and send them to the TVs, this event also blocks the Cutelyst process.
Every TV does a websocket ping each 15 seconds to check if the connection is stalled, when that event happens plus some latency added 15s timeout and the TV disconnect, this of course happens with lots of TVs, so 1k TVs reconnecting will take around 17 seconds, this means new TVs disconnecting and the snow ball is done, system only recovers if I increase the DB hardware on AWS.
How can async fix this, you might be wondering, well the problem is that the 15s timeout happened to do a DOS on my own system, I can increase the value but when there are 10k TVs this will still be a problem, there are of course other ways to deal with this, but if the SQL query doesn't block the Cutelyst process it will be able to timely reply the Websocket's pongs.
ASql only supports PostgreSQL at time (PR are welcome), and depends on QtCore and libpq (PostgreSQL library), it can be used on Desktop apps and is 100% async from connection to queries, there's even a class to help with DB versioning and migration.
Check it out: https://github.com/cutelyst/asql