3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
248 stars 141 forks source link

[Question]: Make communication faster between LWC and QGIS Server #4518

Open Oxsw1ng opened 2 weeks ago

Oxsw1ng commented 2 weeks ago

What is the question? (in English)

My LWC is very slow when it communicates with QGIS (each zoom or movement on the map).
So I wanted to try to compare a project, Tram in Montpellier hosted on the Lizmap demo website, and the other project is hosted on my server. I was looking for the Networks Webtool to compare the two projects on the QGIS Server communication. I was trying to move and zoom in and out to get the maximum of requests.

Here is what I get for the project hosted on the Lizmap demo website : image

And here is what I get on my website : image

We can see that there is more requests on my website and that the green stripes are longer. Those details leads to slow performances on my website (these applies to all other projects). So, I dont know if this can be explained.

More details about my LWC

Multi-threading is activated On the machine which hosts LWC, I have 1 CPU with 8 cores and 4GB RAM.

Versions, safeguards, check summary etc

Versions :

List of safeguards :
* Mode : safe * Allow parent folder : no * Prevent other drive : yes * Prevent PG service : yes * Prevent PG Auth DB : yes * Force PG user&pass : yes * Prevent ECW : yes

Check Lizmap plugin

Operating system

Debian 12

Browsers

Firefox

Browsers version

Firefox 126

Relevant log output

No response

gioman commented 2 weeks ago

@Oxsw1ng It would be interesting to know what versions of LMWC/QGIS Server/etc are used in LMWC demo server, but as a start I would say that you should try with QGIS Server/Desktop 3.34 as there is no point in keeping use an EOL version of QGIS (also 3.34 is basically mandatory for LMWC 3.7+ work as expected).

Oxsw1ng commented 2 weeks ago

@gioman Is there a QGIS Server 3.34 ? Because when I install it on my Debian machine, it tells me thats 3.22 is the latest version of QGIS Server

Gustry commented 2 weeks ago

Each version of QGIS Server is available, at each new monthly release of QGIS https://www.qgis.org/en/site/getinvolved/development/roadmap.html#release-schedule

On the demo server, it's still 3.28, but I think we will switch to QGIS 3.34 this week.

Oxsw1ng commented 2 weeks ago

@Gustry I've tried to switch to QGIS Server 3.36, and it doesn't seem to change a lot of things :/ In fact, my map (OSM) doesn't show up anymore

Gustry commented 2 weeks ago

Is it blank tiles ? What is the status code of your tiles in your web browser ? What are QGIS Server logs (with enough verbosity if necessary) when rendering your tiles ? Is the OSM layer called straight from the OSM server or going through QGIS Server in between.

Oxsw1ng commented 2 weeks ago

Yes, it's blank tiles. I went through my log file and it tells me than cache directory is not accessible. Maybe I need to reconfigure cache directory. The OSM comes from the lizmap base layers, so I guess it's directly called staright from the OSM Server.

Gustry commented 2 weeks ago

The OSM comes from the lizmap base layers, so I guess it's directly called staright from the OSM Server.

So if it's straight from the OSM server, then QGIS Server is not used (and then not the cache directory as well).

Oxsw1ng commented 2 weeks ago

So what do I need to check in Lizmap plugin ? Single tile and check WMS ?

Oxsw1ng commented 2 weeks ago

Because now I dont have logs or console logs anymore. It's just blank and I cant do nothing about it.

gioman commented 2 weeks ago

@Gustry there are some general questions (maybe issues) regarding caching that did not had much traction/attention lately, see https://github.com/3liz/lizmap-web-client/issues/4511 and/or https://github.com/3liz/lizmap-web-client/issues/3696

gioman commented 2 weeks ago

thanks!

josemvm commented 2 weeks ago

an example, the same project with an abysmal difference time loading: qgis server 3.28.15/LWC 3.6.16-pre - 1,28 s qgis server 3.28.15/LWC 3.7.9-pre - 1,37 minutes (first time) imagem qgis server 3.28.15/LWC 3.7.9-pre - 1,28 s (second time and subsequent times)

Oxsw1ng commented 1 week ago

@josemvm So what the solution can be ? If it's due to LWC version, I need to try every version to see which one is the quickest. And is that difference of time of requests processing between two versions of LWC is explainable?

Gustry commented 1 week ago

@Oxsw1ng

The OSM comes from the lizmap base layers, so I guess it's directly called staright from the OSM Server.

So if it's straight from the OSM server, then QGIS Server is not used (and then not the cache directory as well).

What I mean if tiles are straight from the OSM server, then issue is very different if tiles are from QGIS server (even if serving OSM tiles). The button from the plugin to add an OSM layer makes a call straight to OSM server, not using your QGIS server on purpose.

You can see that in your "Request" tab of your web browser.

stateDiagram-v2
    osm : OSM server
    qgis: QGIS Server
    webbrowser: WebBrowser
    osm --> qgis
    qgis --> webbrowser
    osm --> webbrowser

If it's blank tiles from QGIS Server, please check QGIS server logs.

@josemvm Quite surprising indeed. Please provide some logs of QGIS Server, to see the time of QGIS Server when receiving the request and when QGIS Server send back the data. LWc is mainly transfering the data from QGIS Server to the frontend, strange. There are some logic to replace some strings, server settings etc, ACL checks, but still not normal.

@gioman Your issues are not related to this ticket I think.

josemvm commented 1 week ago

@josemvm Quite surprising indeed. Please provide some logs of QGIS Server, to see the time of QGIS Server when receiving the >request and when QGIS Server send back the data. LWc is mainly transfering the data from QGIS Server to the frontend, strange. >There are some logic to replace some strings, server settings etc, ACL checks, but still not normal.

@Gustry i can provide an url if want to inspector. let me know. thanks

Gustry commented 1 week ago

@josemvm QGIS server logs are server side, not client side. With a URL, we can mainly inspect your screenshot above.