title: Moving app to GAE
body: <p><strong>Context:</strong></p>
  
  <p>We have a web application written in <code>Java EE</code> on <code>Glassfish</code> + <code>MySQL</code> with JDBC for storage + <code>XMPP</code> connection for GCM CCS upstream messaging + <code>Quartz</code> scheduler library. Those are the main components of the app.</p>
  
  <p>We're wrapping up our app development stage and we're trying to figure out the best option for deploying it, considering future scalability, both in number of users and their geographical location (ex, multiple VMS on multiple continents, if needed). Currently we're using a single VM instance from DigitalOcean for both the application server <strong>and</strong> the MySQL server, which we can then scale up with some effort (not much, but probably more than GAE).</p>
  
  <p><strong>Questions:</strong></p>
  
  <p>1) From what I understood, <code>Cloud SQL</code> is replicated in multiple datacenters across the world, thus storage-wise, the geographical scalability is assured. So this is a bonus. However, we would need to update the DB interaction code in the app to make use of <code>Cloud SQL</code> structure, thus being locked-in to their platform. Has this been a problem for you ? (I haven't looked at their DB interaction code yet, so I might be off on this one)</p>
  
  <p>2) Do GAE instances work pretty much like a normal VM would ? Are there any differences regarding this aspect ? I've understood the auto-scaling capability, but how are they geographically scalable ? Do you have to select a datacenter location for each individual instance ? Or how can you achieve multiple worldwide instance locations as <code>Cloud SQL</code> does right out of the box ?</p>
  
  <p>3) How would the <code>XMPP connection</code> fare with multiple instances ? Considering each instance is a separate VM, that means each instance will have a unique <code>XMPP connection</code> to the GCM CCS server. That would cause multiple problems, ex if more than 10 instances are being opened, then the 10 simultaneous XMPP connections limit cap will be hit.</p>
  
  <p>4) How would the <code>Quartz</code> scheduler fare with the instances ? Right now we're saving the scheduled jobs in the MySQL database and scheduling them at each server start. If there are multiple instances, that means the jobs will be scheduled on each instance; so if there are multiple instances, the jobs will be scheduled multiple times. We wouldn't want that.</p>
  
  <p>So, if indeed problems 3 &amp; 4 are like I described, what would be the solution to those 2 problems ? Having a <strong>single</strong> instance for the <code>XMPP connection</code> as well as a <strong>single</strong> instance for the <code>Quartz</code> scheduler ?</p>