Saltcorn 0.5.0 - performance

By Tom Nielsen
Published on 30 May 2021

Saltcorn 0.5.0 has been released. This release is focused almost entirely on performance:

When the view state (query string) changes, typically by clicking a filter, the page update is sent over XmlHttpRequest, i.e. AJAX. This technique, which is similar to that used in the Turbolinks or PJAX libraries, has much faster page updates and also mean that the scroll position is not lost. This should lead to a better user experience for dashboards and directories

Metadata is now cached. This means that the structure of your application, that is the table definitions (but not the rows), views, pages, files and triggers are now kept in memory instead of read from the database on every request.

Static assets such as JavaScript and CSS files are now served with their version number in the file path, so they can safely be cashed by thew browser for a much longer time.

Performance for CSV import is much improved. For small files less than 1 MB, the performance is improved by reading the file only once instead of three times. File is larger than 1 MB are in addition processed with a streamed COPY instruction to PostgreSQL. COPY is Faster Than Light, but somewhat brittle and make give poor error messages. It is now also possible to change the HTTP timeout if you plan to upload large files

Sessions can now be stored entirely in encrypted cookies, meaning that database access to store session is not required. This is currently an option, by default off, but has been enabled on for testing.

Benchmarks on have been updated with this new version. For single core servers, there is an overall 2X speed up. However for multi core systems the speed up is smaller. My current hypothesis is that since the main speed up comes from a reduced number of database queries, performance is now dominated by the node.js process which is single threaded. In a future release, we may enable the cluster module to scale across multiple cores. It is also possible that there is some variability in the performance of the DigitalOcean droplets I spin up to make these benchmarks.

Recent posts