Create your own java application website image

Create your own java application website

To create your own java site, there are many important steps and decisions to make with all the different technology options available. I have done a fair amount of research for each step of the process and and will walk you through them.

Choose the right PaaS provider

Here are my notes I have collected from reviewing PaaS providers to support the Play2 framework. Its very raw, subjective, and work in progress but you can learn something from my research so far. The bottom line is that Amazon and Heroku are the clear winners. If you are very technical and enjoy complete control over your environment and database management, you will love Amazon EC2. If you are not very technical or don't want to worry about any of the details, use Heroku with confidence. Each of the other services had things I was uncomfortable with, but the rate things are changing, this wont be the case for very long.

Here are the details:

CloudBees

  • One of the best looking sites with complete integrations to 3rd parties.
  • The RUN side is priced so high I think they want to keep people just testing on the free level.
  • Supports autoscaling (http://wiki.cloudbees.com/bin/view/RUN/Autoscaling+explained)
  • ssl available at a cost
  • Lots of interesting integrations.
BAD

AppFog
BAD

dotCloud
  • Service gets positive mentions on the net but pricing page is difficult to understand. Pricing appears to boil down to $70 per 512m of ram per month
  • Seems to support play2 https://github.com/mchv/play2-on-dotcloud

openshift
  • Developer preview only. Not production ready by any means. If you are just testing things out though, go for it. I was using openshift for a while and enjoyed it being free to test out but keep in mind it is just a developer preview.
  • diy app play uses does not support scaling yet and who knows when it will.
  • the service for me went up and down randomly for a few minutes every few hours (my app running fine through the outage but their proxys must get rebooted alot or something) I ran a broken link checker and believe they restrict load to 10 requests/sec (https://openshift.redhat.com/community/developers/scaling) and drop the rest. Lots of requests never make it to my server so don't run anything you want a bot like google to spider.
  • performance is testworthy only. I was getting 4 requests per second where on a comparable test on EC2 I get 40. jelastic
  • Gets alot of positive mentions. no pure play2 support yet so I stopped looking further.
  • Can use war though and with the latest servlet version it may not be so bad to use war. Appears to have a good value scaling solution and worth looking into for a hobby level user.

Heroku
  • Very play friendly.
  • Highest quality site and experience.
  • Manual scaling is true distributed apps rather than just giving you more cpu power. Gets the most positive mentions for production ready service and quality.
  • cost is 0.05 hr, prorated to the second...about the cost of on demand amazon small. one dyno appears to be equivalent to amazon small according to the forums http://www.smashingboxes.com/heroku-vs-amazon-web-services/
  • lowest database is $50 a month but you can use cleardb and xeround
BAD

Amazon
  • Intimidating at first but not so bad once you learn it.
  • Lots of forums describing how to do anything you could think of.
  • Really is more of an Infrastructure As A Service rather than PaaS.
  • Excellent security setup, complete low latency integration with everything you need.
  • Cost initially seems expensive but paying reserve instance price makes it pretty reasonable to maintain expected levels and just autoscale on demand for unexpected.
BAD
  • ELB serves blank page when all instances down (https://forums.aws.amazon.com/thread.jspa?threadID=72363)
  • Note that I don't think any other PaaS supports custom error pages but I expected more.
  • CloudFront doesn't support PUT/POST so you cant run whole site in front of it. Very intimidating and confusing at first. (Very easy once you learn it.)
  • Elasticache is cool idea but way too expensive. I will just run my own couchbase memcached cluster. Feels very expensive at first but you gotta ignore the on demand price and just pay for a year. Its reasonable when you do reserved.
  • Use on demand for testing. Just paying a few cents to test on identical servers as your own is very cool. Price Notes: Cost On Demand server small is 0.08 per hour. 58.56/mo db small 0.1 per hour $77/mo Cost Reserved 1 Year server small 0.039/hr $28.55 per month db small $40 per month Amazon lets you buy unused cpu power for really cheap. Could run jobs overnight with much more power for cheap.

RackSpace
  • Competitor to amazon. Lower prices, higher performance servers, great support. Best choice if you ONLY need some great servers and are very technical or willing to pay for managed servers (+$100 a month). Word on the street is that their support is awesome. Cost Basic server 512MB $0.022/hr ($16.06/mo)
  • Basic database 512M ram 0.06hr (43.80/mo)
BAD
  • Honestly couldn't bring myself to even try them out once I tried out amazons integrated security and firewall settings and read that Rackspace has nothing like it yet.
  • need to do all the linux image security yourself I hear which is off putting for those not inclined to be sys admins.
  • no direct autoscaling supported but it is possible with 3rd party integrations I hear Database options Database most pass provide is shared, limited to just 10 connections, etc unless you pay lots.
  • After having trouble exporting my database, blackbox DB scares me. There seem to be only 2 real choices out there if you use cloud db: clearDB clearDB is hosted in EC2 & Rackspace but only available through PaaS partner at reasonable prices so you cant use it direct through EC2. I would highly recommend paying the $10 a month and using this instead of any free PaaS database though so you can try out different PaaS providers against the same database. It is a minor pain moving database around. xeround Very interesting NoSQL database with MySQL compatible front end. Apparently scales up much better than RDS at high demand. Cost for basic ec2 & heroku $17 a month rackspace $33 (8MB/s up to 40 connections) Cost for production level service is like $70 a gig per month which is just too expensive for very small revenue company with lots of data. Would be ideal for someone with little data though. Although they claim mysql compatibility, they don't enforce fk and dont allow you to do some modify column commands and its not very clear so buyer beware.

Some relative performance comparison of "free" tier in requests per second:
  • AppFog on AWS 11
  • AppFog on Rackspace 17
  • Openshift 4 AWS micro standalone 40
  • AWS micro with loadbalancer 75 (ELB must have some sort of caching for identical requests)

MEMCACHED NOTES

Most providers offer a memcached integration and there exists a memcached plugin for play2 which works great. So you will probably be using it no matter who you use. Makes it so I can deploy my release without fear of clearing out all my ehcache which would make my micro rds cry when google comes along and cdn happened to expire. If using EC2, Couchbase has a memcached compatible server that is very easy to roll out on amazon. The running server gives you lots of stats and is very easy to manage.
Works great with play2 plugin. http://www.couchbase.com/memcached http://forecastcloudy.net/2011/12/06/membase-cluster-instead-of-elasticache-in-5-minutes/ https://github.com/couchbaselabs/cloud-formation

END NOTES

Amazon has the most impressive offering by far. So much so that I feel the depth I reviewed forums for the multitude of secret "gotchas" of all the others was a waste of my time. (Besides Heroku which is pretty solid if you don't care about cost or international.) With Amazon, it is so easy to start up a totally secured linux instance, customize it exactly the way you like it with your own logging software etc, and then create a template of it you can start/stop/scale at any server size you wish around the world. The interfaces are intimidating at first but once you learn it you can't go back to black box PaaS. All the other PaaS look really nice at first but the magic fades quickly once you realize the hand you were holding becomes a big brick wall between you and your app, and the 3rd party integrations they offer are all you can use and they are not really enterprise grade or the best out there, your performance is heavily throttled so that you pay more money, you have no access to customize/tune your server environment and very limited access to your application logs, can be very hard to debug when something goes wrong, there are lots of little things you realize they don't support like showing you your application load over time/ custom error pages, true instances scaling vs just more cpu, complete provider downtime where you are just screwed, when there are problems you have to wait for their support to help you. Most paas rely on 3rd party NewRelic for application monitoring which is not supported in play2 yet so don't bother trying, paas usually only offer paperTrail to get to your application logs which is basically just an online tail although I am not sure if there is anything better. Having trouble exporting my DB from AppFog really made me want a solid DB solution and all the current sites really make your DB a blackbox. The micro levels of all amazon services are free to test on and I recommend you try running some play demos on them and an RDS. You can run your own mysql on a server but i think that would be a waste of time. With RDS, the ability to control your own backups, scale to different size db machines, multi zone replication, etc make it a better choice even though you pay a bit more for it being managed. (cleardb.com seems like an interesting option though if you want to be more hands off but still have everything running on amazon.) But RDS seems like a great balance between everything getting managed/replicated/backed-up for you but you have the power to do anything you want if you want/need to. Hope this helped you think about some things you may not have.

If there is something you would like to add or have changed, feel free to contact me at the contact footer link.