Showing posts with label JBoss. Show all posts
Showing posts with label JBoss. Show all posts

Monday, April 23, 2012

What does it mean to be JBoss Data Grid ??

Red Hat recently announced beta release of JBoss Data Grid (JDG) , a supported product based on Infinispan. Infinispan was first announced in 2009 and its first GA release was made in February, 2010. So it took more than three years for us, folks at JBoss, to announce a supported beta release. In case you are wondering why it took so long, here are few things to consider. Besides introducing several handy features such as virtual nodes, grouping API, deadlock detection and optimization, improvements with transactions, we wanted to make sure that it
  • can scale in a large cluster. Scalability is a very generic term and its meaning is highly contextual. For JDG, we narrowed down it to two : client scalability and data scalability.
    • Client Scalabilty:  Given a  percentage of data in virtual heap, does JDG handle more client requests as more nodes are added to the cluster? We measure throughput, 99 percentile response  time under read heavy, write heavy scenarios to verify this assertion.
    • Data Scalability: Given a fix number of clients, how much data can be filled in virtual heap while performance metrics such as throughput and 99 percentile response time are still under user defined values. This is again tested under read heavy, write heavy scenarios. 
  • is elastic. Does the cluster scale out and scale in? As nodes are added and removed, how long does it take for cluster to stabilize? This stability is measured by comparing data distribution before and after nodes leave and join.
  • is resilient. While cluster is in active use and node/s crash, what's the impact on throughput, response time? Is there any data inconsistency? How long does it take to stabilize?
  • is stable. Tests are run for long time and monitored for CPU, memory usage, number of full GC, average GC time.
This matrix gets quite complicated if you add various configurations that are available in JDG such as three different end points (Hot Rod, memcached, REST), partially versus fully replicated modes aslo known as "DISTRIBUTED" and  "REPLICATED" mode respectively,  synchronous vs asynchronous replication, number of virtual nodes, READ heavy vs WRITE heavy, L1 cache enabled vs disabled, File Cache Store, JDBC cache store, and so on. 

I have only touched the performance and scalability aspects in details. There are various other functional verification which gets quite complicated as well if you think in terms of OS+JVM+File System + DB combinations we have to certify. 

I can proudly said that we have come a long way and come GA availability, our customers will have in their hands an extremely scalable and highly available data grid platform. And I should mention linear scalability as well!! Wait should not be too long. ;-)

Thursday, August 25, 2011

Java EE6, JBoss AS7 and OpenShift talk at Austin JUG

For August 2011 Austin JUG meeting, Red Hat is sponsoring a talk on Java EE6, JBoss AS 7 and OpenShift. I will be covering JBoss AS7 and EE6 while my colleague David Blado will do a presentation and demo using OpenShift, Red Hat's PAAS offering. I hope to see you Austinites and their neighbors at the meeting. JBoss AS7 landing page talks about 7 reasons to love it but I will give you a very compelling 8th reason and probably more. ;-) In case this all is not appealing enough, there are free pizza and drinks as well. More details at http://austinjug.org/index.jsp?p=events-20110830

Wednesday, December 23, 2009

Book Review: Packt's JBoss Richfaces 3.3

Packt folks sent me a copy of "JBoss Richfaces 3.3" so that I could do a review of the book in my blog. I am almost done with the book and probably would have started on writing review over the holidays break but another review came up which pretty much is in line with what I have in mind. You can read it at http://edemmorny.wordpress.com/2009/12/22/book-review-packts-jboss-richfaces-3-3/ . Thanks Edem for saving me some typing. I would still like to summarize the book in few bullet points:

Good Points:
  • A complete application from start to finish along with Seam and JPA integration.
  • Good explanation of some core Richfaces concepts such as placeholder, ajaxSingle, region, process
  • Skinning support and how you can create yours
  • Good use case for Poll, Push, data iteration component and its partial update
Not so good points:
  • First five chapters of book is equally split between Richfaces, Seam and JPA. Given that this book is for beginner, these other frameworks add to the complexity and more than likely will confuse reader.
  • Seam is a great framework but it's not a must have to use Richfaces. The book gives you an impression that you can not get easily started with Richfaces without Seam and seamgen.
How would I have written this book:

Given that the book is tailored towards readers who are familiar with JSF 1.2 ,I would have started with a simple JSF project and added Richfaces feature
on top of the project. Then describe how Richfaces lifecycle fits into JSF lifecyle and so on. This way transition is smooth and helps a reader see how Richfaces fits well with JSF. Most of users who post questions in Richfaces user forum fall into the group who know JSF and want to know more about Richfaces.

I wish you happy holidays and a great new year.

Wednesday, July 8, 2009

From JSF to Richfaces to Richfaces Portlet

We are going to start with a very simple JSF web application then convert that to a very simple Richfaces web application and then ultimately convert that Richfaces web application to Richfaces Portlet. This tutorial assumes that you have basic knowlege of JSF. All code used in this tutorial are at http://anonsvn.jboss.org/repos/qa/prabhat/. This application simply gives you some financial advice based on your age and your current savings. We all need some financial advice these days, don't we? ;-)

Converting a JSF application to Richfaces is a 3 step process:

1. Add Richfaces filter and some default parameters:

<!-- Plugging the "Blue Sky" skin into the project -->
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>

<!-- Making the RichFaces skin spread to standard HTML controls -->
<context-param>
<param-name>org.richfaces.CONTROL_SKINNING</param-name>
<param-value>enable</param-value>
</context-param>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>

<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>

2. Add Richfaces binaries to WEB-INF/lib:
You need three jars:

richfaces-api.jars
richfaces-ui.jar
richfaces-impl.jar

3. Add Richfaces components to your page:
You need to import two tag libraries. For a JSP page, you would need

<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>

For an XHTMl page, you would need

<xmlns:a4j="http://richfaces.org/a4j">
<xmlns:rich="http://richfaces.org/rich">

Just doing these changes will make your page look pretty i.e. Rich.


From






To




Note:
1. If you deploy these app into JBoss AS, you do not need to bundle jsf jars in your war but you need them when deploying in tomcat.
2. Adding Richfaces config and binaries to an existing JSF project is very simple using JBoss Tools or JBDS. You simply add "Richfaces Capabilities".

Converting a Richfaces application to Richfaces Portlet

Since Portlets run on portal server, converting a web app to portlet is not that straightforward. I guess that's why there is no add "Portlet Capabilities" in JBoss Tools/JBDS. But it's equally easy to get started using Maven archetypes. Portlet based on JSF/Richfaces/Struts run on a portal server through portlet bridge. There is a separate project called JBoss Portlet Bridge which allows you to do that that for JSF/Richfaces/Seam based portlets. This project provides different maven archetypes to get you quickly started with these portlets. For richfaces based portlet, you would need to do


mvn archetype:generate -DarchetypeGroupId=org.jboss.portletbridge.archetypes -DarchetypeArtifactId=richfaces-basic -DarchetypeVersion=1.0.0.CR2 -DgroupId=org.jboss.test -DartifactId=richfaces-portlet -DarchetypeRepository=http://repository.jboss.org/maven2/

The archetype will create all required deployment descriptors portlet.xml,portlet-instances.xml, jboss-portlet.xml which you of course would need to update. We are going to import richfaces pages we created previously to this project and modify deployment descriptors accordingly. The important changes are portlet and portal server specific deployment descriptors and hooking up bridge with JSF.

1. Portlet Bridge's view handler and state manager on top of JSF/Richfaces
Modify faces-config.xml so that it has

<application>
<view-handler>org.jboss.portletbridge.application.PortletViewHandler</view-handler>
<state-manager>org.jboss.portletbridge.application.PortletStateManager</state-manager>
</application>

2. The Bridge Portlet to wrap xhtml as a view state of portlet

<portlet>
<portlet-name>SimpleRichfacesPortlet</portlet-name>
<portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
<init-param>
<name>javax.portlet.faces.defaultViewId.view</name>
<value>/introduction.xhtml</value>
</init-param>
<init-param>
<name>javax.portlet.faces.preserveActionParams</name>
<value>true</value>
</init-param>
<expiration-cache>-0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
<portlet-info>
<title>Simple Richfaces Portlet</title>
</portlet-info>
</portlet>

We are configuring that GenericFacesPortlet is the portlet, it supports view mode and for default view, we are going to use introduction.xhtml that we created in JSF and Richfaces.

3. portlet-instances.xml does not change in this context i.e it's same as that of any java portlet

4. Inject needed Richfaces javascripts using jboss-portlet.xml

<portlet>
<portlet-name>SimpleRichfacesPortlet</portlet-name>
<header-content>
<script src="/faces/rfRes/org/ajax4jsf/framework.pack.js" type="text/javascript"></script>
<script src="/faces/rfRes/org/richfaces/ui.pack.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/faces/rfRes/org/richfaces/skin.xcss">
</header-content>
</portlet>


This portlet when deployed to JBoss Portal looks like: