Friday, 20 November 2015

Write MapGuide application once. Run MapGuide application anywhere?

MapGuide is a very flexible development platform, allowing you to build your MapGuide applications in either .net, PHP or Java.

Depending on your OS, you currently have the following development/deployment options:
  • Deploy .net or PHP on IIS
  • Deploy PHP or Java (in a Tomcat Servlet container) on Apache HTTPD
But what if we could be even more flexible than that? What if you deploy to any platform regardless of whether your application is .net, Java or PHP.

We now have the components that can make this a possibility.
  • .net is now cross-platform. The canonical recommended deployment strategy of 5 applications is done through hosting the application via the Kestrel HTTP server, and reverse-proxying to it from a more industrial-strength HTTP server.
  • The HttpPlatformHandler module for IIS allows it to do process management and request proxying for other http listeners (like Tomcat or Kestrel), making it possible for IIS to "host" Java or .net Core applications.
So regardless of whether you're on .net*, PHP or Java we now have the means to deploy and host it on both Windows and Linux.

* Yes, there's a small caveat in this idealized scenario. It requires:
  1. A CoreCLR-compatible wrapper for the MapGuide API. This is something I'm playing around with at the moment.
  2. Your .net MapGuide application basically has to target the .net Core profile (and not the full .net Framework) in order to take advantage of the cross-platform deployment scenario.
  3. That we can reverse-proxy to Kestrel from Apache HTTPD. The official documentation refer to nginx as the front-facing web server, but if the ability to reverse proxy is the sole requirement, then any web server that has the capability can be the front-facing web server and not just nginx.

Thursday, 19 November 2015

Making the mapagent serve more useful looking JSON

Let's make that SELECTFEATURES mapagent operation a bit more useful!

Tuesday, 3 November 2015

MapGuide tidbits: Improving bundled PHP performance

NOTE: This tip only applies to PHP that is bundled with MapGuide Open Source 2.6 and newer.

MapGuide Open Source 2.6 and newer bundles the 5.5.x series of PHP, which includes a new opcode caching feature. Opcode caching can reduce execution times by upwards of 50% (as is the case with our mapguide-rest functional test suite which usually took around 6 minutes to run, but now runs in just over 3 minutes with opcode caching enabled)

In the interest of playing it safe, we didn't activate this feature in the default php.ini that's bundled with MapGuide. So if you want to activate this feature, you'll have to edit php.ini and add the following lines:

;Enable the opcode caching extensions
;On Linux, the path should be

;Some default opcode caching options. Adjust as necessary

Save the file (and restart the web server to re-jig PHP if required) and enjoy your faster PHP scripts!

UPDATE (18 Nov): Upon further testing, I've been finding that PHP opcache is horribly unstable on Windows (see this and this). So enable this feature at your own peril!