Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapcache creates multible session for getting http sources and not a single one #310

Closed
a14stoner opened this issue Mar 27, 2023 · 6 comments

Comments

@a14stoner
Copy link

a14stoner commented Mar 27, 2023

I am seeding a map with a http source.
Within one our mapcache creates around 720.000 sessions (one per request).

Is it possible that mapcache requests the images within one session and not creates one session for every requested image?

@sdlime
Copy link
Member

sdlime commented Mar 30, 2023

Hi @a14stoner, this is probably a better question for the mapserver-users mailing list. More folks will see it there and should be able to help. I'm not a mapcache expert but I think folks will need more information on:

  • when you say seeding, are you referring to using mapcache_seed? With what options?
  • if not, how is mapcache deployed (Apache module or FastCGI)?

I typically don't pre-seed and just let the cache build as users interact with the tilesets. I've not noticed anything strange in that case. I do occasionally do targeted re-tiling for small data changes and use mapcache_seed for that.

@a14stoner
Copy link
Author

a14stoner commented Mar 30, 2023 via email

@marisn
Copy link
Contributor

marisn commented Oct 14, 2023

This seems to be doable. I don't have time (and need) to implement it, thus just notes.

Download happens in http.c function mapcache_http_do_request and there is no session/connection/DNS reuse implemented.
https://github.com/MapServer/mapcache/blob/main/lib/http.c#L102

Libcurl supports sharing of cookies, DNS, ssl and even connections. The documentation has nice examples:
https://everything.curl.dev/libcurl/sharing

One option would be to create three new functions: http_setup, http_do_request and http_teardown. This would allow to change separate places in code without a major rewrite of each mapcache_http_do_request callee. As for the seeder process – each worker thread could setup its own libcurl handle with shared properties and thus there would be no need for making a clever mutex-based locking. I don't know if there should be a cli flag to disable/enable such functionality.

@jratike80
Copy link

@a14stoner, please tell why did you close the ticket. I hope you have found a solution for your issue.

@marisn
Copy link
Contributor

marisn commented Oct 17, 2024

IMHO this should be reopened as it is a reasonable thing to implement. It could speed up seeding process a bit (although only testing could tell).

@a14stoner
Copy link
Author

I simply dont need it anymore. If you want I'll reopen it. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants