searching for the maximum speed I can get from our mapcache service, I'm going to make some test in a new server (AWS EC2) with Nginx as a reverse proxy and Apache before to update the live system.

our Mapcache uses the SQLite cache as we run out of inodes if we try to cache the whole UK with disk cache.

At the moment our Mapcache service is set up in Apache in http/1 and apache default config. I've just added apache compression and cache

this is the map service.


we use it to seed about 60 websites (the project it's a map-based app, so it require a map that we seed with the previous service) and around 15000 connections a month.

I'm using 128 x 128 tile size and the map requires a lot of images to be displayed.

How stable is Mapcache 1.6.1 with Nginx and how should I setup Mapcache?

I know there are instructions but I don't understand some points.


these are the steps to build my actual setup

cd mapcache-1.6.1
mkdir build
cd build
cmake   -DCMAKE_PREFIX_PATH="usr/bin/sqlite3" \
        -DWITH_SQLITE=1 \
        -DWITH_BERKELEY_DB=0 \
        -DWITH_TIFF=0 \
        -DWITH_GEOTIFF=0 \
        -DWITH_FCGI=0 \
        -DWITH_PCRE=0 \

I add this to the httpd.conf:

LoadModule mapcache_module    modules/mod_mapcache.so

<IfModule mapcache_module>
  <Directory /usr/local/src/mapcache-1.6.1>
    Require all granted
    MapCacheAlias /mapcache "/usr/local/src/mapcache-1.6.1/build/mapcache.xml"

If I want to use Nginx as a reverse proxy (in Http/2) and speed up the cache I need to build it from scratch as in the instructions and change the configuration to use Mapcache with Nginx? Or still, I will use both of them? Can I use yum install Nginx and then add the module?

The part about The basic configuration without any proxying.... Where should be put? In the mapcache.xml?

Is there any particular apache and Nginx config that I should use?

I'm using apache MPM event in the live system but in the test server I'm using MPM prefork, they told me that it's better and probably will be implemented also in the live system.

I'm also having a lot of problem at the time to seed the map, it takes ages. In the test server I'm seeding a small portion of UK but still it requiring a lot of times.

I'm using these resolutions 280 140 70 28 14 7 6.16 2.8 1.4 0.7 with this script

su -s /bin/sh apache -c "/usr/local/bin/mapcache_seed -c /usr/local/src/mapcache-1.6.1/build/mapcache.xml -t bccache -g bcgrid -n 400"

I know the rule of the -n parameter but if I use -n 4 it simply takes even more time and when I check the CPU load is not even in use.

Below the square I'm using to make tests.

enter image description here

  • If seeding takes ages then I bet that the WMS service that you are caching is slow. And if WMS service is slow it is usually because source data are not properly pre-processed or configured. – user30184 Mar 1 '19 at 8:53
  • our map files have something like 30 layers or so, i recently change the MIN/MAXZOOM with MIN/MAXSCALEDENOM and the we have some custom style. this is one of our layers ` NAME "Background" TYPE POLYGON # MINSCALEDENOM 2001 MAXSCALEDENOM 20000 STATUS DEFAULT CONNECTIONTYPE OGR CONNECTION "Background.shp" CLASS NAME "Background" STYLE COLOR 235 235 235 END END PROJECTION "init=epsg:27700" END END` – Sebastiano Mar 1 '19 at 9:09
  • 1
    Evaluating how to increase the speed of rendering is not that easy. One would need the real data and mapfile and make thorough testing. Definitely too broad question for this forum. – user30184 Mar 1 '19 at 9:14
  • :( so you think that basically is not a problem of the server configuration but more about the data itself and the .MAP file? – Sebastiano Mar 1 '19 at 9:15
  • That is the usual case but I can't say if it is your case as well. – user30184 Mar 1 '19 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.