Aug 30, 2009

Google Maps API V3

I was doing some work with  Google Maps API V3 during last couple of weeks,
and here are some of my experience with this version.

  • Very small footprint and quite fast.
  • Although in Beta I think it is quite stable to be used in production - if of course you are ready to follow with latest developments and fixings.
  • A small but annoying bug I discovered (for which I filled a ticket : http://code.google.com/p/gmaps-api-issues/issues/detail?id=1643 along with a work around)
  • A tip : Since there is no way to hide-show the zoom - pan and Map type selection controls through api you have do it by writing some javascript 
        var housediv=yourmapObject.getDiv();
        if (housediv.childNodes[3]) { 
            housediv.childNodes[3].className = myClass 
            housediv.childNodes[4].className = myClass 
        } 
         // if exist 
        //controls reside in childnode[3] and [4] of container div 
        //rest is done with CSS class where you can hide-show or change the opacity

Aug 16, 2009

Be careful with Yaml editing

The other day I have almost erased an application of mine in App Engine the only thing that saved my day is that I was working on a version.
So how this happened to me ?
Well you edit your yaml file which probably have been copy/pasted from some other application , you read it, you are satisfied with what you see and you decide to upload on the spot so here we are: appcfg ... and presto your old application is gone coz you forgot to save this yaml which looked good to your eyes.
You see appcfg does not read through your own eyes it prefers its own devices which can read a complete different story than yours.

Server Instance Life time

This was always an issue since the beginning of GAE, with people suggesting fake requests or cron jobs to keep an instance alive.
I am following the issue since the very beginning and although I do not have indisputable numbers to share here there is one thing I can tell for sure the average timeout has increased quite a lot since the early days and currently is satisfactory to the extend that any application with reasonable hits, can expect to almost always be served from a hot instance.

CPU and latency of a bare bones application.

I have done some research today regarding App Engine's response time cpu usage etc.
I got some conclusions but need more verification before posting those here but between some tests I decided to check what is the minimum cpu time usage when starting cold, so I creating a brand new application I uploaded a plain "Hello World application, with a bare minimum configuration.

Just a single yaml handler and a print statement for output no import whatsoever.

I was amassed to see in in the logs that a cold start would cost around 100 cpu_ms or more with successive requests consuming around 10 cpu_ms and request time latency of more than 100 ms in the hot start.

So if we have a proper application with cpu consuption and latencey close enough to above values we are doing wanders.

One more remark on the aftermath of these tests today, do not forget to include a favicon to the handler since most of the browsers will request for it any way and the cost of this request and the denial is probably greater than provide one in the first place.
And ... here are the real logs where you can see a Cold % Start and successive Hot Starts :
    1. 08-16 10:37AM 50.074 /Hot%20Start 200 8ms 8cpu_ms 0kb Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.198.1 Safari/532.0,gzip(gfe)
    1. 08-16 10:37AM 48.149 /favicon.ico 200 11ms 14cpu_ms 0kb Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.198.1 Safari/532.0,gzip(gfe)
    1. 08-16 10:37AM 47.616 /Hot%20Start 200 37ms 55cpu_ms 0kb Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.198.1 Safari/532.0,gzip(gfe)
    1. 08-16 10:37AM 37.885 /favicon.ico 200 24ms 16cpu_ms 0kb Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.198.1 Safari/532.0,gzip(gfe)
    1. 08-16 10:37AM 37.340 /Cold%20Start 200 229ms 168cpu_ms 0kb Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.198.1 Safari/532.0,gzip(gfe)
    1. 08-16 09:27AM 29.460 /favicon.ico 200 7ms 6cpu_ms 0kb Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.198.1 Safari/532.0,gzip(gfe)

Google Application Engine

Well... after more than a year that I spent some of my free time doing development on the cloud mostly with Google Application Engine, I decided to start this blog as a means of keeping some notes of the whole process.
Hoping this will be valuable to me and any others working in this field.
Probably I am starting this a little too late, but then again "never is too late never is too far" since I do believe the "cloud" is here to stay.