Use Fast CGI for long running processes of mapping (e.g. to allow caching)
Enable mod_proxy_fcgi:
sudo a2enmod proxy_fcgi
Edit Apache conf for a path that connects via FCGI to a given port
ProxyPass "/mapping" "fcgi://localhost:1337/"
Install spawn-fcgi to spawn process(es) of mapping that Apache connect to
sudo apt-get install spawn-fcgi
Spawn a single process of mapping
sudo -u www-data FCGI_WEB_SERVER_ADDRS=127.0.0.1 spawn-fcgi -p 1337 mapping_cgi
Spawn multiple processes of mapping
sudo -u www-data FCGI_WEB_SERVER_ADDRS=127.0.0.1 spawn-fcgi -p 1337 -F 2 mapping_cgi