Saturday, May 28, 2011

Elastic Caching Providers

In my previous post we have discussed about how to increase performace & scalability of web applications. Also, cloud based application growing day and night, I thought it would be nice to point out most of caching providing. In todays world we have different clients (web, mobile, ipad etc) for an application and as developer you have to make sure that your application handling users load, and these requirements have produced a diverse elastic caching market that includes not only the large vendors but some open source solutions:

Oracle Coherence and GigaSpaces eXtreme Application Platform (XAP) are the veterans. Oracle and GigaSpaces have the longest presences in the distributed caching market. Both offer elastic caching products today to both enterprise and Web customers, although mostly to enterprise customers. Oracle incorporates its Coherence product into two of its Fusion Middleware bundles but sells the product separately as well.

IBM and Terracotta challenge Oracle and GigaSpaces across the board. IBM and Terracotta (now Software AG) arrived later to the elastic caching platforms market but are challenging the veterans for both enterprise and Web accounts. IBM’s WebSphere eXtreme Scale will get attention as they came with XC10 device, IBM now has hit stride with the product primarily as an extension of architectures based on its WebSphere Application Server.

Terracotta makes its software available under both open source and conventional licenses, and it focuses almost exclusively on selling through developers. Terracotta expanded its offerings by buying Ehcache, a popular open source client-side product, and positioning Ehcache as the primary API to its elastic caching platform. As Amazon is one of the Elastic Caching Pioneer and they provides terracotta caching solution with EC2.

Spring GemStone is focused on big enterprise projects. GemStone has focused almost exclusively on large enterprise projects in financial services, defense, and intelligence. GemStone is a software industry veteran with a history in the Smalltalk language and object-oriented databases and has applied its expertise and technology to the problem of elastic caching. Gem Store will be integrated with other spring framework and Spring TC server (offering session replication at extreme scale), as per spring, other potential area to integrate with spring web flow to provide (transparent flow replication).

Red Hat JBoss is an emerging player. Red Hat’s JBoss middleware division has begun phasing out its distributed caching software (bundled with JBoss as JBoss Cache) and will replace it with the new Infinispan elastic cache. Infinispan is in a very early stage of commercialization, and I it to gain lots of attention from Java developers and eventually build a position in the market as a strong alternative.

Membase which is now part of CouchBase, provides distributed, key-value ("NoSQL") database management system optimized for storing data behind web applications. These applications are characterized by their need to serve many interactive users concurrently; they must create, store, retrieve, aggregate, manipulate and present data in real-time.

Now since we have listed most of the players from EC world. If I would have to choose one or two from above i'll go with terracotta or IBM as they provides more option for developer and their EC solutions seems to better compare to some other one.

Have fun with EC...


Saturday, May 14, 2011

How to scale your application: Cloud & Cache

From last few days, I have been reading a book about "Web Scalability" and some intresting articles about “scalability”. In a nut shell, how to improve performance and better scale your application. With this post today I’m going to discuss some major choices to dramatically raise the scale of applications:

Scaling option # 1: Add servers to increase capacity. Add servers or virtual machines to cache user Web sessions, execute business logic, and process transactions. Each added server carries the cost of hardware, software, electricity, and ongoing management. Even if you buy more application servers, your database may then become a new bottleneck. Databases can be redesigned to scale up or out, but it is often very costly to do so. The new buzz, Cloud computing can deliver server instances on demand, but it cannot redesign your application code and data to take advantage of additional resources. And soon or latter one will realize and say, “We can’t just keep throwing hardware at the problem.”

Scaling option # 2: Re-architect the application for greater capacity. Redesign the application for greater capacity by sharding databases, going stateless, splitting functions, improving the layering and separation of concerns, and/or adding asynchronous processing, common services, caches at every layer, single-function appliances, etc. or thorowing new pattern to re-factor some or most of code will take lots of time and money. Most organizations find this remedy too slow to deliver results and sometimes too risky and expensive. Your management and more likely users will say “We’ve got a problem now — we can’t wait a year to solve it.”

Scaling option # 3: Add caches that scale easily. Elastic caching platforms add a fast, scalable, and fault-tolerant data-access layer that can be used to cache transaction results, user session objects, shared application data and other data. Most organizations find that elastic caches easily fit into existing Web architectures and improve scale at a lower cost than the first two options. Also since mobile development is on high right now, that area can really get advantage of cachine solution, as they can choose what object, variable to cache or not to cache. Once you use this solution no one will go back to previoud options.

If you didn’t get bored so far and reached here, Congrates!!! And by now it would have been clear to most of you, that I’m going with 3rd option to gain scalability of web applications. Hopefully in coming days will post more about major caching players.


Saturday, April 30, 2011

Cloud Foundry: Will it be better from existing PaaS?

Recently VMWare has launched Cloud Foundry, the world’s first open Platform as a Service (PaaS). Cloud Foundry is designed to help developers create applications within a "platform Cloud" or a "development Cloud."

As a developer you will be able to sign up and login and write code directly on a Spring or Rails environment. You can deploy your application on a Spring Source tcServer instance and make use of running database services like MySQL and MongoDB. For STS users, the easiest way to get started with Cloud Foundry plugin is by installing it into a pre-installed copy of Spring Source Tool Suite which can be found on the download page. For Eclipse users, Cloud Foundry plugin can quite easily be installed into plain Eclipse installations. To make sure that all dependencies can be satisfied during installation you should start installing the “Eclipse IDE for JEE Developers” package. This package can be downloaded from the Eclipse download page or from the Spring Source member distribution page.

Some benefits of Cloud Foundry might include:

· Multiple Frameworks – choices of programming models

Cloud Foundry provides a platform for building, deploying, and running cloud apps using Spring for Java developers. And support applications those are using spring framework for code wiring purpose or for resource configuration purpose, such as data source look up etc.

· Multiple Services- choices of services from VMware and third parties

o Cloud Foundry is open to multiple services including basic relational databases as well as broader choices like MongoDB, MySQL and Redis. Services provide data storage and other functions that can be leveraged by applications. Examples of additional service integrations will include VMware’s vFabric application services. The vFabric Cloud Application Platform includes open source Spring Development Framework as well as a set of application services including a lightweight application server, global data management, cloud-ready messaging, and application performance management capabilities.

· Multiple Clouds - choices of clouds for deployment

o Cloud Foundry provides choice of underlying deployment destinations including a public cloud service at Cloud Foundry. Cloud Foundry make this framework available as downloadable instance to run on other cloud providers like Amazon EC2, and other IaaS offerings technologies like Eucalyptus or OpenStack.

· Developers can deploy their applications to Cloud Foundry using their existing tools and with zero modification to their code.

· As any PaaS, Cloud Foundry allows developers to focus on applications, not machines or middleware.

· Most PaaS offerings restrict developer choices of frameworks, application infrastructure services and deployment clouds. The open and extensible nature of Cloud Foundry means developers will not be locked into a single framework, single set of application services or a single cloud.

Cloud Foundry supports:

· Rails and Sinatra for Ruby developers.

· Node.js which is an event-driven I/O framework for V8 java script engine on Unix-like platforms.

· JVM frameworks including Grails.

· JVM languages such as Clojure and Scala.

Cloud Foundry Architecture

Application execution engine is one of the core building blocks of Cloud Foundry Architecture. It’s an agent that runs on each node that actually runs the application. It acts as an automation engine for application deployment and lifecycle management. Also includes scriptable command line interface (CLI) that provides access to VMWare cloud application platform. Integration with development tools such as Spring Source Tool Suite(STS), Grails and Spring Roo for development. These tools utilize the Cloud Foundry client web services API and Spring Source artifact repositories to deploy applications under Cloud Foundry.

The pieces that make up Cloud Foundry architecture are:

· At the core the Application Execution Engine is the piece that runs your application. It’s what launches and manages the Rails, Java, and other language app servers. As your application is scaled up, application engine will launch an application server with deployed code. It can be launched on any suitably configured server, which then connects to the other servers in the PaaS and starts running user applications (the application execution engines can be configured to run a single application per server or multiple).

· The Request Router is the front door to the PaaS: it accepts all the HTTP requests for all the applications running in the PaaS and routes them to the best app execution engine that runs the appropriate application code. In essence the request router is a load balancer that knows about which application is running where.

· The Cloud Controller implements the external API used by tools to load/unload applications and control their environment, including the number of application execution engines that should run each application. As part of taking in new applications it creates the bundles that application execution engines load to run an application. One aspect of the cloud controller is that it is relatively policy-free, meaning that it relies on external input to perform operations such as scaling how many application execution engines each application uses. This allows different management policies to be plugged-in.

· A set of Services which provide data storage and other functions that can be leveraged by applications. Each service tends to consist of two parts: the application implementing the service itself (e.g. MySQL, MongoDB, Redis) and a Cloud Foundry management layer that establishes the connections between applications and the service itself.

· A Health Manager responsible for keeping applications alive and ensuring that if an application execution engine crashes the applications it ran are restarted elsewhere.

The following diagram summarizes the basic idea behind Cloud Foundry:

Developer Frameworks

Cloud Foundry Supports multiple framework like Spring for Java, Rails and Sinatra for Ruby, and Node.js. There is also support for Grails on Groovy and other JVM-based frameworks.

Application Services

Application Services allow developers to take advantage of data, messaging, and web services as building blocks for their applications. For Data Service, Cloud Foundry currently offers support for MySQL, MongoDB and Redis with other service integrations underway. For Messaging service, they will offer their own Rabbit MQ and other messaging services. Examples of additional service integrations will include VMware’s vFabric application services.

Initially they are going to provide multiple services provided by VMWare itself, and eventually, open it up to the ecosystem for third-parties (similar to Heroku Add-Ons or Salesforce.com AppExchange)

Clouds

Public, Private, VMware based and non-VMware based it up to the developer and organization as to where they want to run Cloud Foundry.

Finally, you'll notice there is reference to a "Downloadable 'Micro Cloud'". Micro Cloud is a single developer instance of Cloud Foundry. It provides developers with a personal PaaS that runs on their desktop. Micro Cloud is provided as a downloadable software image for VMware Fusion or VMware Player, as well a hosted image on selected cloud partners like you can run on an(e.g. Amazon Machine Image). The idea behind the Micro Cloud is to appeal mostly to developers and let them easily do development in any physical location, as well as easily load their app to a Cloud Foundry cloud when they are ready.

Cloud Foundry’s code is open source at github under the Apache 2 License.

https://github.com/cloudfoundry/vcap

I think it has potential to compete with other cloud providers. What do you think? Does Cloud Foundry have the potential to compete with likes of Google AppEngine or Amazon EC2?


Friday, April 15, 2011

Terracotta Ehcache Proivdes Search Functionality

Ehcache is one of the widely used java distributed cache for caching purpose. As you might know that Ehcache has been aqquired by Terracotta inc. one of the pioneer for providing distributed caching funtionality.

Ehcache can serve as a local cache that the applicaitons can use to boost the performance of single node or multi-node applications.

Terracotta provides distributed object caching essential for elastic scalability and next-generation cloud environments. One of the pioneer in Cloud services, Amazon EC2 also provides Terracotta integration with their cloud instance if your application require one.

For more information on this topic please visit:

http://www.terracotta.org/news/pr/2011/2011-02-15-ehcache-search-released

Tuesday, March 1, 2011

Spring In Action - Book Review

Spring in Action”, as the book title suggest, this book is all about Spring and let me tell you this book is EXCELLENT for spring framework user. And if you are new spring framework user or advanced developer or has been using Spring framework. This book is perfect for you. Spring in Action 3E is new book for Spring in Action Series books. This book covers Spring framework core concept and all of the other modules from spring framework. So, if you want to be expert in using spring framework this book can help you achieve this goal. I have personally used this book for examples and for reference purpose. Thanks to manning publication also for providing such nice books.

Starting from chapter one, user get to know about spring framework concept and two very important fact of spring programming, one is DI “dependency Injection” and other is AOP “Aspect Oriented Programming”. And this books covers these concepts in great details with some very useful examples.

Second chapter will take you deep in to DI advanced concept, Wiring beans, injecting bean and how spring works with Auto Wiring. I would say these two chapter are must read to understand Spring core fundamental concepts.

Chapter three will teach you about how you can wire your bean togeather, like using XML configuration, Java Config etc…and use of different type of XML schemas..

Fourth Chapter will take you to AOP world. This is very powerful feature in todays programming model and this chapter will teach about basic features about Aspect programming language and how you can use AOP with spring framework.

Fifth chapter will teach about JDBC and other how spring take care of DB connection, exception and how you can use spring framework to connect to DB.

Chapter six will cover the most important aspect of programming “Transaction”, as how to integrate with different Transaction Manager, how to manage transaction withour relying on Container. Also, this chapter cover how to use transaction using annotation.

Chapter seven covers spring MVC framework, with very easy examples to demonstrate powerful MVC framework.

Eight chapter will extend further UI works and will cover about Web Flow framework.

Chapter ninth covers about Spring Security and how to secure your web application using servlet filters, also cover fundamental about security like authorzation and authentication.

Next two chapters are the most critial chapters from this book sa they talk about how to expose service using RMI and how to use Web Services with Spring Framework. I think in todays world using web services are important, but to use them correctly is more important. This chapter covers some good concept about using web services with Spring.

This next chapter covers how to use JMS with Spring framework. Also, covers what spring offers you for JMS APIs.

I persoanlly have used this book and would recommend every spring users to take a look at it, as this book present lots of useful example for each spring modules.

Thanks to Craig Walls for writing very nice book.

Tuesday, February 22, 2011

Spring Integration In Action- Book Review

In last few weeks I have red two very interesting books (Camel in Action and Spring Integration in Action) from Manning. These two books are implements/supports Enterprise Integration Pattern. Well, this review is about “Spring Integration in Action”, so let’s talk about that. Before we go further in to book review, I would like to congrates Mark Fisher & authors as they have done tremendous job in writing this book.

After reading first chapter "Introduction to Spring Integration", you could sense that this book is very well written with well defined chapters. This book can be very informative to user who doesn't know anything about Messaging and for advanced users ready to play with Spring Integration and want to apply some Enterprise Integration Pattern.

Inside the Book

This book contain some where are around 19 chapters and since not all of them are out yet, but so far and each chapter is well defined and up to the point.

Chapter 1 covers good introduction to "Core Messaging" and tooling around Messaging like Router, Message Adopter and spillter. Also, I like the approach taken by Authors by saying "Spring Integration" support Enterprise Integration Pattern instead of Implementing EIP.

Chapter 2 covers Fundamental of EIP "Enterprise Integration Pattern" - This makes this chapter a must read for beginners as this cover some background about EIP and some basic fundamental about EIP.

Chapter 3 covers messages, channel and transaction and relationship between them, and also provides some good examples.

Chapter 4 & 5 provides details about End point, topics and transformer and different types of Channel Adopter available in Spring Integration framework.

Chapter 6 will take you deep in with some examples as how you can build and test some of the POJOs, and how to connect them to channel -

Chapter 7 will take you to another big topic called Router and Filter APIs, and different types of router provided by Spring Integration.

Chapter 9 will provide you details about XML messages payloads and how spring integration provides supports for XML messages.

Chapter 10- This is very interesting chapter as this provides details about relationship between JMS and Spring Integration Framework. I think this chapter is very useful for folks who have used JMS APIs.

Chapter 12 - This chapter cover about how to integrate file system with Spring Integration and how to use one of the channel adopter.

Chapter 18 - This chapter cover scalability messaging with OSGI and integration with RabbitMQ,

Chapter 19- Testing with Spring Integration with set of examples to better understand Spring Integration concepts.

If you have played with Spring Framework and would like to use Spring Integration framework, this book will provide you basic as well as advanced topics. Check it out and ENJOY..

Hope this would help.

Saturday, February 19, 2011

EJB 3.1 Security example

I have been playing with different bean types from EJB3.1. EE6 and really improved JEE specs, EJB has been around for sometime now and until now its been really hard for developer to manage them with interfaces, deployment descriptor etc.
EE6 introduced new era of EJB3.1 that I think this should make life easy for developer (who wants to use EJBs). And surely annotations will reduce more code base in applications.
I have not been big fan of EJBs, that MIGHT change now as EJBs now more or less look like POJOs.
Let me show you how easy it is now to write EJB. Here's security EJB example from EJB3.1

First we have write EJB code with different security annotations. I have written Servlets to test it with EJB injection in to Servlet.
This example has been tested in GlassFish, to run this you need to have Global security set up and also you need to map role with defined users, in this case its "Authorized"...

here you go..

import javax.annotation.Resource;
import javax.annotation.security.DeclareRoles;
import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
import javax.ejb.LocalBean;
import javax.ejb.SessionContext;
import javax.ejb.Stateless;
/**
* Session Bean implementation class MathSecTestEJb
*/
@Stateless
@LocalBean
@DeclareRoles({"Authorized"})
public class MathSecTestEJb {
/**
* Default constructor.
*/
public MathSecTestEJb() {
// TODO Auto-generated constructor stub
}

@Resource SessionContext ctx;
@RolesAllowed("Authorized")
public void printRoleName(){
System.out.println(ctx.getCallerPrincipal().getName());
}

@PermitAll
public int addNumber(int a, int b){
return a+b;
}
}
import java.io.IOException;
import javax.annotation.security.RolesAllowed;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.HttpConstraint;
import javax.servlet.annotation.ServletSecurity;
import javax.servlet.annotation.ServletSecurity.TransportGuarantee;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import vk.test.secejb.MathSecTestEJb;
/**
* Servlet implementation class MathSecServlet
*/
@WebServlet("/MathSecServlet")
@ServletSecurity(
@HttpConstraint(rolesAllowed = {"Authorized"}))
@RolesAllowed({"Authorized"})
public class MathSecServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public MathSecServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(request,response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
processNumber(request, response);
processRole(request, response);
}

@EJB MathSecTestEJb mathejb;
public void processNumber(HttpServletRequest request, HttpServletResponse response) throws IOException{
response.getOutputStream().println(mathejb.addNumber(5, 10));
}

@EJB MathSecTestEJb mathej;
@RolesAllowed({"Authorized"})
public void processRole(HttpServletRequest request, HttpServletResponse response) throws IOException{
mathej.printRoleName();
}

}

Thursday, February 3, 2011

Camel In Action - Book Review

Last few days I have been reading Camel In Action from Manning Publication. After reading this "In Action" series book, I must say as always manning books are great for beginner and advanced users. Let's talk about book "Camel In Action" this books provides good overview of "Apache Camel" and why it's one of the best Enterprise Integration Pattern out there. This books cover good implementation details about Apache Camel with lots of code example to make it easier for developers.

Inside the Book

Although, this book contain some where are around 14 chapter and all of them make it really good read. I'm going to cover first eight chapters as these chapters considered as core camel.

Chapter 1 - This Chapter names as "Meet with Camel", as described from its name, this chapter provides good details about Apache Camel and it's architecture.

Chapter 2&3- This chapter covers fundamental concepts like routing and transformation with some very good example codes.

Chapter 4- This chapter covers details about how to work with simple beans with Camel and also provides examples to integrate with Spring.

Chapter 5- Error handing as one of most important aspect of any programming, this chapter divide errors in two segment "recoverable" and "irrecoverable" and covers it very well
with some nice example.

Chapter 6 - Testing with Camel, as name suggested, this chapter talks about testing Junit and testing mock component with Camel.

Chapter 7- This chapter covers different components like Asynchronous messaging , web services etc...in camel.

Chapter 8 - Enterprise Integration Pattern, as name suggested this chapter cover fundamental of Enterprise Integration pattern and details about EIP (e.g aggregator, spillter)

There are some very interesting chapters ahead like transaction, concurrency and scalability, developing camel projects etc. Which makes this book a must read if you really want to know about "Apache Camel".

I hope this review would help.

Tuesday, January 25, 2011

SOA Patterns Book Review

Recently I spent lot of time reading this book SOA Patterns. I like the problem and solution approach from this book. With this approach, users know what problem or scenario they are trying to solve with SOA architecture. This book will help enterprise to promote and build SOA solutions. This book is excellent for beginners and for advanced developers also. It actually provides very in-depth details about SOA architecture.
This book really targets practical problem and how to resolve them by adopting SOA. Chapter three and four are my favorites as they talk about pattern for performance, scalability and availability and most important aspect of SOA security.
I’m going to spread words about this book in my enterprise. I hope this review will help.

Saturday, January 22, 2011

Spring Integration - Enterprise Integration Pattern

As always, recently spring provided Enterprise Integration Pattern solution with the introduction of Spring Integration. It extends the Spring programming model into the messaging domain and builds upon Spring's existing enterprise integration support to provide an even higher level of abstraction. It supports message-driven architectures where inversion of control applies to runtime concerns, such as when certain business logic should execute and where the response should be sent. It supports routing and transformation of messages so that different transports and different data formats can be integrated without impacting testability. In other words, the messaging and integration concerns are handled by the framework, so business components are further isolated from the infrastructure and developers are relieved of complex integration responsibilities.
Spring Integration provides functionality with diffrent types of adapters, router, filter, spiltter and transformer as described in Enterprise integration Pattern. I think the real compatitor for Spring Integration is apache Camel project, Which provides similar functionality. if you are ready to use ESB, In my view these two are great option out of the box for enterprise integration pattern. which can solve lots of non complex scenrio. But if an app needed more complex routing and some advanced ESB features then an open source ESB like WSO2 or Mule might be right choice.