November 1st, 2010 by Moti Karmona | מוטי קרמונה · 3 Comments
In continue to my geo distance post, I have decided to post something on the simplest cloud architecture (RDS) for location based services (LBS)
IMHO, (to cut a long story short :) Amazon RDS is more than enough for most geo location applications.
Amazon Relational Database Service (Amazon RDS) is a web service that makes it easy to set up, operate, and scale a relational database in the cloud.
Amazon RDS gives you access to the full capabilities of a familiar MySQL database. This means the code, applications, and tools you already use today with your existing MySQL databases work seamlessly with Amazon RDS.
Two preliminary steps:
* Start a small DB instance with the kind help of AWS management console (image above)
* Use the RDS instance as if it is your “disruptive” MySQL instance e.g. manage it using MySQL Workbench 5.2.29
“Flirting” with MySQL spatial capabilities (which seems to be “fully” supported by AWS RDS)
INSERT INTO locations VALUES(1,40.748433, -73.985655, GeomFromText(‘POINT(40.748433 -73.985655)’), ‘The Empire State Building‘);
INSERT INTO locations VALUES(2, 40.689166, -74.044444, GeomFromText(‘POINT(40.689166 -74.044444)’), ‘The Statue of Liberty’);
INSERT INTO locations VALUES(3, 40.758611, -73.979166, GeomFromText(‘POINT(40.758611 -73.979166)’), ‘Rockefeller Center’);
INSERT INTO locations VALUES(4, 40.757266, -73.985838, GeomFromText(‘POINT(40.757266 -73.985838)’), ‘Times Square’);
INSERT INTO locations VALUES(5, 40.7527, -73.9818, GeomFromText(‘POINT(40.7527 -73.9818)’), ‘New York Public Library’);
* Execute a simple test drive query which returns all the locations and their distance from ‘The Empire State Building’ + Comparing two distance calculation methods (1) MySQL euclidean calculation (2) Haversine calculation (results below)
SELECT locations.name, astext(locations.loc), GLength(LineStringFromWKB(LineString(locations.loc, GeomFromText(‘POINT(40.748433 -73.985655)’))))*100 AS euclidean, 6378.1 * 2 * ASIN(SQRT( POWER(SIN(RADIANS(40.748433 – locations.lat) / 2),2) + COS(RADIANS(40.748433)) * COS(RADIANS(locations.lat) ) * POWER(SIN((RADIANS(-73.985655 – locations.long)) /2), 2) )) AS haversine FROM locations — HAVING euclidean < 1 – ORDER BY euclidean ASC LIMIT 10;
Two Surprises/Issues
(1)SRID (Spatial Reference Identifier) support in MySQL is a disgrace – In MySQL, the SRID value is just an integer associated with the geometry value. All calculations are done assuming Euclidean (planar) geometry.
Possible Workarounds: (1) Euclidean calculation can be enough (2) Use Haversine function if you need the accuracy
Important note: To help new AWS customers get started in the cloud, AWS is introducing a new free usage tier. Beginning November 1, new AWScustomers will be able to run a free Amazon EC2 Micro Instance for a year, while also leveraging a new free usage tier for Amazon S3, Amazon Elastic Block Store, Amazon Elastic Load Balancing, and AWSdata transfer – Very Exciting Times!!!
Disturbing unrelated fact: Starting in 1931, every graduate of the Japanese Naval Academy was asked: “How would you carry out a surprise attack on Pearl Harbor?”
September 15th, 2010 by Moti Karmona | מוטי קרמונה · 12 Comments
It started like yet-another-weekend-experiment but once you start a weekend experiment you never know when or how it will end… ;)
I was very curios to take AWS for a quick test drive so I lost six hours of a precious beauty sleep and compiled this blog-post-capsule for future generations.
The plan was to use this tutorial but surprisingly enough this did not work out-of-the-box (apparently due to Tomcat/JDK versions on the default AMI the plug-in is using but I didn’t waste time in making sure this is the issue) so I moved to plan B
Plan B – Create a custom EC2 AMI with Tomcat 6.something and JDK 1.6
* Launch an EC2 instance using Amazon’s ami-84db39ed AMI. (basic Fedora 8 image)
* Use Putty connect to your instance
* Install Java on EC2 Instance
* Download JDK (“Linux RPM in self-extracting JDK file”)
* Create EBS Image AMI from your instance (it does takes couple of minutes to complete)
* Open your eclipse and start a new AWS project as described in the original link
* Define a new EC2 Server in Eclipse using your new AMI (reminder: the default didn’t work)
* Create your “Hello World!!!1” Servlet
April 18th, 2010 by Moti Karmona | מוטי קרמונה · No Comments
“The further a project progressed, the more accurate the estimates for the remaining effort and time became”
(Barry Boehm, “Software Engineering Economics“, 1981)
NASA also came to the same conclusion that in the beginning of the project life cycle (i.e. before gathering of requirements) estimations have in general an uncertainty of factor 4. This means that the actual duration can be 4 times or 1/4th of the first estimations…
I felt very free to add my own interpretation of the different point-of-views with cool pastel colors as a sneak-peak cool-beta-preview of my next post.
December 12th, 2009 by Moti Karmona | מוטי קרמונה · 2 Comments
This is my recommended check-list for high level design review.
*********************************************************************** *** keep it simple and make sure it answers all the requirements ***
***********************************************************************
Reverify your Requirements
Functional specification, use cases and requirements are clear and publicly documented