In this post, I will write what technical stuff, work related I experienced, and my in-heart feeling throughout today. Today I will use English to touch about work related, but use Chinese to express my thoughts.
WOW, first hour in this morning I had implemented an interesting stuff, that is to build a simple cache manager in front of Dao (Dao Access Object) class. It is an in-memory model, the data will be kept in the server’s memory. Every cached data will have expired time, it will be automatically refreshed when the time is expired, moreover, when the insert / update / delete operation of specific Dao class is executed, the cache data associated with it will be refreshed automatically. The best thing is in current system framework can easily migrate to use this cache manager without having a big changes. The next step I should do is to create custom configuration setting for cache manager, or by using Annotation to realize auto configuration. OK, the benefits of Cache Manager is, the system is able to not query database everytime when need it but read from the cache directly, it should be able to increase application performance since database operation always eat up more resources. I just have make cache for certain parts of system that need cache, and any other places is not affected. I should continually to test it to know the real performance had brought by this changes.
At the time I feel boring in front of computer, I had researched Asynchronous Servlet 3.0 Proposal, it added some additional methods to existing Servlet 2.5 to handle asynchronous use cases, such as Ajax, or Comet (Reverse Ajax), or Streaming. I also thought if current system framework is able to integrate with this feature, and I need more research in order to make conclusion. In our company we use Tomcat, and I know Tomcat 6 had its own Comet Servlet implementation, but I am not sure if it is a standard or not, the better for us is following standard in order our system can be migrated to any type of web server. Now, Java EE 6 had supported Asynchronous Servlet 3.0 and had been released last year, and the best supporting web server is Glassfish, by using Glassfish you can easily deploy Java EE 6 and EJB 3.1 applications, furthermore, it supports what "modern browser" had supported, HTML5 WebSocket (bi-directional socket connection between server and browser client). Let’s try it if you interested.
For information, I had also briefly introduced cloud computing service I had used to my colleagues. But I am sorry I have no convey clear information when I am introducing. Now, here, to all readers, why cloud is your better choice?
I had used Google Appengine and Amazon Web Service before, even in my final year project during degree study, these two are the leading cloud computing service provider in the world. If you don’t know what is cloud computing, many information online had told you what this is. Many advantages brought from cloud, to enterprise and to individuals. In simple, the main advantage is to cut cost, pay on what you use; easy to scale up to more server instances in short time when your application needs it, and scale down when your application don’t need it; more secure (somebody may not agreed this, but theoritically to hack cloud is very hard in this stage).
In short, Google Appengine provides full stack infrastructure framework includes everything what you needs such as Google Datastore (a BigTable key-value data store implementation) that you can used to store data (like database) using JPA or JDO that you familiar or low-level API if you want to. It also provides Memcache, Image Service, Task Scheduling Service, Queue, Channel API (to make Comet Application). It provides free to use at first, you don’t need to pay single cent to run your first Hello World Google Appengine application, and only the time your application had brought in more bandwidth, meant that is the time you start to earn money, then you have to pay, just pay on what you use.
Amazon Web Service is another cloud computing service provider besides from Google Appengine. AWS provides many types of cloud service, such as Amazon EC2, Amazon Simple Storage Service, Amazon RDS, and many more. It provides lower level cloud infrastructure, therefore you need more knowledge to operate on.
By using Amazon EC2, it virtualizes a blank server for you, and you are able to install anything you want, just like a normal server you get from data centre. Second, it is pay on what you use, one hour just 0.085 US Dollar. You can run it in, say 3 hours, and closed it when you don’t want. Sometimes I want to test my web application, I just click click click in the user interface (or you can also use window command prompt) to access a Linux server instance and upload my applications and test, from my home, very convenient. I really not need to buy a Linux server keep in my home, waste my money, when I don’t want it, I can close it and return back, it will not charge me afterwards. EC2 has also provides an important feature called AMI (Amazon Machine Image). Meant, when you had headache to build up your web server, your database, and your applications, you can store the current setting into AMI, and then you close the EC2 server instance, AMI will be stored on Amazon S3. When you need it, you can just restart your application based on AMI you have made last time, you don’t need even to have another headache time to rebuild up your web server and cumbersome database. Some people had also created some setup and saves as public AMI and you can directly use their AMI to continue your own setup. You can also sell your created AMI in marketplace, or make it private, use by yourself. WOW… Additional information, EC2 provides full stack of real time monitoring feature, you can always easily know the performance or health of every part of your server.
EC2 is for computation, it cannot keep data last long. You should use Amazon S3, to store your static files. You are able to upload any static files, video, images, create folders on Amazon S3, and it provides a public URL for your friend to download. You can set different access permission to different folders, files, you had created. Same, pay based on what you use. Currently, I had used Amazon S3 for more than 700MB, and charged me 10 cents US Dollar each month. WOW, amazingly, so cheap. I used it to backup my company program code (I had backup in many places in case any accidents occurred) every days. I used it for private usage, and it should not be able for publicly viewed.
Who use Amazon Web Services? The fact is that part of the Facebook Photos using Amazon S3 to store their photos because Amazon S3 provides more stable and easy to use feature. Secondly, Second Life used Amazon EC2 to run their virtual 3D world instance. They can just focus on development of application logic but leaves the lower infrastructure to Amazon EC2.
Maybe our company should try cloud computing service (or maybe had already tried), but I am not sure if it is suitable, still need more research to make conclusion. Because I know the manager should have many problems regarding this: is it safe? is it really cut cost? is it suitable for us and customers and I can’t answer it clearly at this time.