Home » U++ Library support » U++ SQL » Transfer compress data
Transfer compress data [message #59821] |
Wed, 26 April 2023 12:59  |
 |
forlano
Messages: 1207 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Hello,
my app communicate with a MySql database online.
I wonder if the data transfer can be done in a compressed/zipped way to speed the whole procedure.
Thanks,
Luigi
[Updated on: Wed, 26 April 2023 16:49] Report message to a moderator
|
|
|
Re: Transfer compress data [message #59830 is a reply to message #59821] |
Sat, 29 April 2023 00:25   |
zsolt
Messages: 702 Registered: December 2005 Location: Budapest, Hungary
|
Contributor |
|
|
Hello Luigi,
A had a same problem, so I created a backend part for my U++ software.
It receives JSON data as arguments in HTTP and the responses are also in JSON. This way it can be used by not only my GUI app, but a Javascript SPA (single page app) also.
HTTP is good, because I put my backent behind an Nginx reverse proxy. Nginx can compress the responses.
The other problem, you can had solved with this solution is the latency, caused by multiple SQL queries. E.g. user opens a data entry window with a lot of droplists and/or converts, based on the database, that generates a lot of SQL queries one by one, adding a very large latency. Using this JSON requests, you can send all the parameters to the server (the backend) in a JSON. It runs all the queries in place and sends back all the results in one JSON, so the latency is one request-response time only.
Jsonize framework is very useful here.
|
|
|
|
Re: Transfer compress data [message #59833 is a reply to message #59832] |
Sat, 29 April 2023 18:24  |
zsolt
Messages: 702 Registered: December 2005 Location: Budapest, Hungary
|
Contributor |
|
|
It is good to know, that if you don't plan using a Javascript client, the normal Serialize framework can be much better (faster and more compact).
JSON is not very efficient to transfer query results (2 dimension array of values), so I had to create a class to implement it more efficiently.
It serializes field names as an array of strings and rows as raw JSON value array (2 dimensions). Something like a CSV.
|
|
|
Goto Forum:
Current Time: Fri Apr 25 12:01:01 CEST 2025
Total time taken to generate the page: 0.00518 seconds
|