Flex Push Architectures fr.HUGO

One of my favorite subjects to preach about is the importance of designing push architectures in enterprise systems. The classic example of when a push architecture is needed is the dashboard. In order to keep a dashboard up to date the options are to have the client program regularly poll the server for changes or to have the server push updated information to the dashboard when necessary. The later alternative performs and scales better.

The problem is how to implement such architecture with web clients. A server can’t push data to web clients due to the stateless nature of http. The market has come up with a number of solutions to this problem. I talked about such solutions in an earlier post. The reason I am going back to this subject is due to new developments in Flex.

Flex is the form based cousin of Flash. It is arguably the most complete RIA framework in the market. Quick disclosure, I started working for Adobe a few days ago. Yet, I used Flex extensively in other projects before. There are two developments that made in my opinion Flex an attractive option for push architectures. First, last year Flex itself became Open Source. That means the Flex SDK is available for anybody to use at no cost. Second, in February this year, the Flex server product became Open Source in the form of BlazeDS. With BlazeDS you have access to powerful remoting capabilities. With BlazeDS a Flex application can access POJOs directly and most importantly it can subscribe to topics on the server.

Leave a Comment

Discover the power

ConcurrentHashMap of EhCache vs HashMap vs ConcurrentHashMap

The benefits of java.util.concurrent.ConcurrentHashMap over a regular synchronized HashMap become blatantly apparent when we run a small experiment to simulate what might happen in the case of a map used as a frequently-accessed cache on a moderately busy server. See the details at http://www.javamex.com/tutorials/concurrenthashmap_scalability.shtml

But here is the problem http://www.informit.com/guides/content.aspx?g=java&seqNum=246

The truth

A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updates. This class obeys the same functional specification as Hashtable, and includes versions of methods corresponding to each method of Hashtable. However, even though all operations are thread-safe, retrieval operations do not entail locking, and there is not any support for locking the entire table in a way that prevents all access. This class is fully interoperable with Hashtable in programs that rely on its thread safety but not on its synchronization details.

Try and get the latest of version of ConcurrentHashMap of EhCache instead of java.util.concurrent.ConcurrentHashMap.

Leave a Comment

Caching Techniques using spring AOP

<!– Implementation of Data Service & Caching Advice : –>
<aop:config>
<!– Data Caching Advice –>
<aop:advisor id=”referenceCachingAdvisor” pointcut=”execution(* com.interface101.xml.impl.ReferenceDataImpl.getReferenceData(..))”
advice-ref=”methodCachingAdvice” />
</aop:config>

<bean id=”methodCachingAdvice”>
<property name=”cache”>
<ref local=”methodCache” />
</property>
</bean>
<!– Begin Cache Configuration –>
<bean id=”cacheManager”>
<property name=”configLocation”>
<value>classpath:ehcache.xml</value>
</property>
<property name=”shared”>
<value>true</value>
</property>
</bean>
<bean id=”methodCache”>
<property name=”cacheManager”>
<ref local=”cacheManager” />
</property>
<property name=”cacheName”>
<value>cache.REFERENCE_DATA_CACHE</value>
</property>
</bean>

Comments (2)

Building SWC File using FlexMojos plugins in Maven

<?xml version=”1.0″ encoding=”UTF-8″?>
<project xmlns=”http://maven.apache.org/POM/4.0.0&#8243; xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd”&gt;


<modelVersion>4.0.0</modelVersion>
<groupId>interface101-flex-security</groupId>
<artifactId>interface101-flex-security</artifactId>
<version>0.0.1</version>
<packaging>swc</packaging>

<build>
<defaultGoal>install</defaultGoal>
<sourceDirectory>src/main/flex</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>3.2.0</version>
<extensions>true</extensions>
<configuration>
<targetPlayer>10.0.0</targetPlayer>
<allowSourcePathOverlap>true</allowSourcePathOverlap>
<namespaces>
<namespace>
<uri>http://www.interface101.com/admin/security</uri&gt;
<manifest>src/main/resources/manifest.xml</manifest>
</namespace>
</namespaces>
<includeNamespaces>
<namespace>http://www.interface101.com/admin/security</namespace&gt;
</includeNamespaces>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>flex-support</groupId>
<artifactId>flex-support</artifactId>
<version>1.0.0</version>
<type>swc</type>
<scope>external</scope>
</dependency>
</dependencies>
</project>

Leave a Comment

Agile #1 Principle

Build

  • Requirements are clearly communicated and understood (at a high level) at the outset
  • Requirements are prioritized appropriately based on the needs of the user and market
  • Requirements can be clarified on a daily basis with the entire project team, rather than resorting to lengthy documents that aren’t read or are misunderstood
  • Emerging requirements can be factored into the development schedule as appropriate with the impact and trade-off decisions clearly understood
  • The right product is delivered
  • As iterations of the product are delivered, that the product meets user expectations
  • The product is more intuitive and easy to use
  • The user/business is seen to be interested in the development on a daily basis
  • The user/business sees the commitment of the team
  • Developers are accountable, sharing progress openly with the user/business every day
  • There is complete transparency as there is nothing to hide
  • The user/business shares responsibility for issues arising in development; it’s not a customer-supplier relationship but a joint team effort
  • Timely decisions can be made, about features, priorities, issues, and when the product is ready
  • Responsibility is shared; the team is responsible together for delivery of the product
  • Individuals are accountable, reporting for themselves in daily updates that involve the user/business
  • When the going gets tough, the whole team – business and technical – works together!

Comments (1)

Flex Performance

Tips and Techniques for Improving Client Application Performance

  • Use dynamically repeating controls for better performance
  1. Increase the duration of your effect with the duration property.
  2. The less there is for Flash Player to redraw during an animation, the
    smoother the effect plays.
  3. Avoid bitmap based backgrounds
  • Achieving Great Performance with Runtime Styles
  1. A common mistake that impacts performance is overusing or unnecessarily using the setStyle() method. In general, you only need the setStyle() method when you want to change styles on existing objects. Do not use it when setting up styles for an object for the first time. Instead, set styles in an <mx:Style> block, as explicit style properties on the MXML tag, through an external CSS style sheet, or as global styles. It is important to initialize your objects with the correct style information, if you do not expect these styles to change while your program executes (whether it is your application, a new view in a navigator container, or a dynamically created component).
  2. Some applications need to call the setStyle() method during the application or object instantiation. If this is the case, call the setStyle() method early in the instantiation phase to avoid unnecessary lookups. Early in the instantiation phase means setting styles from the component or application’s initialize event, instead of the creationComplete or other event. By setting the styles as early as possible during initialization, you avoid unnecessary style notification and lookup.
  • Using Dynamically Repeating Controls for Better Performance
  1. New in Flex 1.5 is the addition of the HorizontalList and TileList controls. You can use these controls for layouts that require dynamically repeating elements. They perform much better than layouts that used Repeaters. In fact, layouts created during the Flex 1.0 timeframe that used a Repeater may often be replaced by a combination of the HorizontalList or TileList controls and cell renderers for better performance.
  • Improving a Repeater Object’s Performance

    There are a few things to think about if you need to improve your Repeater object’s performance. First, if you are using containers as the child of the Repeater object, check whether using a HorizontalList or TileList control would be better. If that is not the case, ensure that the containers used as the children of the Repeater do not have unnecessary container nesting and are as trim as possible. If a single instance of the repeated view takes a noticeable time to instantiate, repeating makes it worse. As mentioned previously in this article, multiple Grid containers in a Repeater object do not perform well because Grid containers themselves are resourceintensive containers to instantiate. An alternative solution is to try a List control with a custom cell renderer or the HorizontalList or
    TileList controls.

    You should also set the recycleChildren property to true to improve a Repeater object’s performance. The recycleChildren property is a boolean value that, when set to true, binds new data items into existing Repeater children, incrementally creates new children if there are more data items, and destroys extra children that are no longer required. When you set this property to false, the Repeater object recreates all the repeated objects when you swap dataProvider properties, sort, and so on, which causes a performance lag.

  • Performance test your own Flex application

Test the performance of your application early and often. It is always best to identify problem areas early and resolve them in an iterative manner, rather then trying to shove performance enhancements into existing, poorly performing code at the end of your application development cycle.

  • Using Runtime Shared Libraries (RSLs)

You can shrink the size of your application’s resulting SWF file by externalizing shared assets into standalone files that you can separately download and cache on the client. Multiple Flex applications can load these shared assets at runtime, but each client need only to download them once. These shared files are called Runtime Shared Libraries. Flex projects that have multiple Flex applications downloaded to the client can leverage RSLs for better performance. More specifically, the time it takes to download a Flex application once the initial RSL has been downloaded is significantly reduced. However, not all applications benefit from RSLs.

  1. Large applications that load multiple smaller applications can be linked to a shared RSL
  2. A family of applications on a server built with a shared RSL
  3. A frequently changing application that has a large set of infrequently changing components

————————————————————————-

Leave a Comment

Flex World

Green Flex World

BlazeDS Components

  • Messaging Services
  • RPC Services
    • RemoteObject
    • HTTPService
    • WebService
  • RPC Services – Provides a call and response model for accessing external data. Lets you create applications that make asynchronous requests to remote services that process the requests, and then return data to your Flex application
  • Messaging Services – Provides messaging services for collaborative and real-time applications. Lets you create applications that can send messages to and receive messages from other applications, including Flex applications and Java Message Service (JMS) applications.

Arch
Arch

RemoteObject based on the Action Message Format (AMF) will be the best of three as per implementation I have.

Leave a Comment

Older Posts »
Follow

Get every new post delivered to your Inbox.