Previous Next

Technical Blog

September 2009

In Elastic Path 6.1.1, we added support for search server clustering, which greatly improved scalability and reliability. In our testing since that time, we've found that large-scale deployments that are clustering the search server can benefit from certain optimizations to index replication and search request distribution. Also, in 6.1.2, we upgraded to Solr 1.3, which brought overall performance gains, including improved indexing performance. Finally, we've updated the replication scripts to use the new snapshot "check" functionality, making the scripts more efficient by duplicating less redundant data.

 

Master Index Replication Interval

The frequency for running the snapshot script depends on how often the slave machines need the updated indexes. Of course, you need to consider the performance impact on the system, and the size of your indexes and the frequency of updates have a direct impact. If you have large indexes, consider a longer interval between snapshots. If the indexes need to be updated frequently, you may require a shorter interval. Keep in mind that frequent index replication across slave servers can affect performance. You may want to experiment to determine the optimal interval that balances your needs for frequency of updates against performance.


The snapshooter.ep script has the responsibility of taking a snapshot of the current master index. There are two ways to run it:

  • By running a cron job at a predefined interval (this is the default)
  • By using Solr's postCommit hook, which fires the script after a commit is complete.


Typically, we recommend using a cron job, unless you need to replicate your indexes more often than in 1-minute intervals or you've changed the frequency at which your Quartz indexers check for new objects to index (normally this is defaulted at 5 seconds). With recent changes from the Solr 1.3 scripts, the snapshooter.ep script now compares the previous snapshot files with the current index files and will only duplicate an index if it has changed. With this new feature, you can set your interval to be quite frequent without additional overhead of duplicating unchanged indexes. For example, in a cron job, you can run this every minute.

 

The advantage of using the postCommit hooks is that there is much more control over when you take a snapshot because they're only run when an actual change is made to an index. A snapshot can be taken post-commit, post-optimize, or both. To use postCommit replication, do the following:

 

  1. Modify snapshooter.ep.start to accept an argument that specifies which index you want to replicate (instead of having them all replicate with one call). For example, you would specify snapshooter.ep.start -i product to create only a product index snapshot.
  2. Update the Solr config file for that specific index to cause replication on a product post-commit. For example, edit WEB-INF/solrHome/conf/product.config.xml to add the following example:

   

product.config.xml Example
<!-- A postCommit event is fired after every commit or optimize command -->
     <listener event="postCommit" class="solr.RunExecutableListener">
       <str name="exe">/path/to/searchserver/WEB-INF/solrHome/bin/snapshooter.ep.start</str>
       <str name="dir">/path/to/searchserver/WEB
-INF/solrHome/bin</str>
       <bool name="wait">true</bool>
       <arr name="args"><str>-i</str><str>product</str></arr>
       <arr name="env"></arr>
     </listener>

 

Note: In 6.1.2, postCommit replication is now be done properly; Solr 1.3 included a fix for an issue that caused each commit call to be run twice. Prior to the fix, using a postCommit snapshot would produce multiple snapshots, wasting CPU time and disk space.

Slave Index Installation Interval

snappuller.ep maintains a status of the last index that was pulled, and therefore, will not unnecessarily pull down indexes on the master that have already been pulled. As a result, this script can be run at fairly regular intervals. snapinstaller.ep also maintains a status of the last index installed and will not attempt to re-install indexes that have already been installed. Therefore, similar to snappuller.ep, this script can be run at fairly regular intervals with little overhead.

 

HTTP Search Request Distribution over Master/Slave(s)

Although the master search server is fully capable of handling search requests from the storefront and CM client, we typically recommend that only the slave nodes handle search requests. Keep in mind that index replication isn't instantaneous. There's a delay between the time the master search server indexes a new object and the time it becomes searchable on the slave. With requests only going through to the slaves, this delay is consistent and all objects will show at the same time on all nodes. Also, you'll want to reduce the load on the master server and let it focus on continuous indexing, if necessary.

 

To take advantage of these changes, be sure to download the 6.1.2 search server cluster/failover scripts from the downloads area at http://grep.elasticpath.com/docs/DOC-1278 (requires login).

0 Comments Permalink


The performance team at Elastic Path has recently gone through Oracle RAC validation with Elastic Path 6.1.1 and made it out the other side unscathed. And the best part, is that there are no code changes required on EP out-of-the-box to fully support Oracle RAC with Fast-Connection-Failover (FCF).


The benefits of Oracle RAC (Real Application Clusters, or Oracle database clustering in simple terms) are three-fold: performance, scalability, and reliability. Which one matters the most to you depends on your needs, but usually having the assurance of database failover is the most valuable, with scalability and performance coming a close second.


In our testing, we used WebLogic 10.0.1 and Oracle 11g (Release 1) on physical machines using Intel Xeon quad-core 2.5Ghz CPUs and 8GBs RAM. The OS was 64-bit RedHat EL 5.  In-house, we are typically able to push a single Oracle node to capacity with 3 EP storefront nodes. For our validation testing, with a four storefront configuration, we were utilizing roughly 50-60% capacity on a two node RAC configuration. The following is a rough guide for setting up RAC for EP.

 

RAC Configuration w/ EP

Deployment and configuration of Oracle Clusterware and Oracle 11g was fairly straight-forward and required no special configuration with Elastic Path, other than the standard RAC connection config outlined below. Oracle's online documentation for the Clusterware  set up is excellent and very detailed when you need to drill down.


Once the Clusterware and database are up and running, and your data has been populated, there are many different ways to set up RAC with WebLogic. See the WebLogic documentation for details. WebLogic recommends the use of multi data sources to connect to the RAC nodes. This method supports failover and load-balancing at the application level which is more effective as WebLogic's health monitors can be used and failover is done more quickly than Connect-Time failover or allowing the cluster-ware to handle this. It is recommended to set up a data source for each RAC node. Below is a configuration example for the data source XML; it is based on a two node setup (a data source for each node) and the DS pool.



WebLogic Data Source Example XML

<jdbc-data-source>

<name>jdbcPool</name>

<jdbc-driver-params>

  <url>jdbc:oracle:thin:@lcqsol24:1521:snrac1</url>

  <driver-name>oracle.jdbc.OracleDriver</driver-name>

  <properties>

   <property>

    <name>user</name>

    <value>wlsqa</value>

   </property>

  </properties>

  <password-encrypted>{3DES}aP/xScCS8uI=</password-encrypted>

</jdbc-driver-params>

<jdbc-connection-pool-params>

  <test-connections-on-reserve>true</test-connections-on-reserve>

  <test-table-name>SQL SELECT 1 FROM DUAL</test-table-name>

</jdbc-connection-pool-params>

<jdbc-data-source-params>

  <jndi-name>jdbcDataSource</jndi-name>

</jdbc-data-source-params>

</jdbc-data-source>


<jdbc-data-source>

<name>jdbcPool2</name>

<jdbc-driver-params>

  <url>jdbc:oracle:thin:@lcqsol25:1521:SNRAC2</url>

  <driver-name>oracle.jdbc.OracleDriver</driver-name>

  <properties>

   <property>

    <name>user</name>

    <value>wlsqa</value>

   </property>

  </properties>

  <password-encrypted>{3DES}aP/xScCS8uI=</password-encrypted>

</jdbc-driver-params>

<jdbc-connection-pool-params>

  <test-connections-on-reserve>true</test-connections-on-reserve>

  <test-table-name>SQL SELECT 1 FROM DUAL</test-table-name>

</jdbc-connection-pool-params>

<jdbc-data-source-params>

  <jndi-name>jdbcDataSource2</jndi-name>

  <global-transactions-protocol>OnePhaseCommit</global-transactions-protocol>

</jdbc-data-source-params>

</jdbc-data-source>


<jdbc-data-source>

<name>jdbcNonXAMultiPool</name>

<jdbc-data-source-params>

  <jndi-name>jdbcDataSource</jndi-name>

  <algorithm-type>Failover</algorithm-type>

  <data-source-list>jdbcPool,jdbcPool2</data-source-list>

  <failover-request-if-busy>true</failover-request-if-busy>

</jdbc-data-source-params>

</jdbc-data-source>


 

Fast-Connection-Failover

WebLogic also supports Fast-Connection-Failover (FCF). This mechanism provides a means to receive event notification from the Oracle RAC nodes such as notification and cleanup of invalid connections, load balancing events, and node failures. In order to enable FCF, you must tweak the Oracle JDBC driver and add a couple additional properties to the data source connection such that it knows how to receive the ONS (Oracle Notification System) messages.

 

To enable FCF on a data source:

  1. In the WebLogic console, under the data source:
    1. In Driver Class Name, set the driver class to oracle.jdbc.pool.OracleDataSource.
    2. In Properties, set the ONS configuration string to subscribe to RAC's ONS messages, for example: ONSConfiguration=nodes=hostname1:port1,hostname2:port2
  2. Finally, make sure that ONS is properly configured on the RAC nodes and you have no blocking firewalls on those ports on either the RAC nodes or the application server nodes.
3 Comments Permalink

Rumba is the code name for Elastic Path Commerce 6.1.2, which was officially released to customers early last week. The development work on this release began in late April and finished in August. Dubbed a feature release, it has a bit of everything included in it.

 

The key focus of Rumba was rounding out the tagging framework and dynamic content functionality. The tagging framework was enhanced to include tag value types, which allow for easy definition of UI helpers for various tags, validation of tag values and localization among other things. The reusable generic condition builder underwent a major facelift, when we introduced an easy to follow UI, nested conditions and a combination of AND and OR operators, which will allow users to take their shopper segmentation to the next level. Shopper segmentation was further enhanced by the introduction of several new tagging events and corresponding tags such as cart subtotal and in store search terms. We also provided a sample GEO IP 3rdparty integration with Quova. Through the integration with Quova, we developed several highly useful GEO IP tags such as country code tag, state/province tag, top level domain tag etc. All of these tags will make GEO targeting a very appealing prospect for our clients.

 

During the second half of Rumba development, we focused on usability enhancements and client requested fixes to existing functionality. We added column sorting to frequently used areas of the CM Client such as Order and Product Searches. This usability work will allow Customer Service Reps, Catalog Managers and other CM Client users to be much more efficient in their day to day tasks. We also improved the save message prompts in CM Client to include additional information about the objects being saved, which will allow CM Client users to make faster and more informed decisions.

Another area of the system that experienced a facelift is the permissions structure. Previously, everyone with access to CM Client had read permission on everything and read, update and write permissions on explicitly assigned areas of the CM Client. In 6.1.2, we've implemented a restricted view access policy, so that users who are not assigned specific activities, catalogs, stores and warehouses will not have access to them at all. Finally, the tax calculations for inclusive tax jurisdictions were improved, by addressing bugs for edge cases. As a result, taxes are now covered by extensive automated tests, which will serve as a model of how we can better automate the testing of key aspects of our platform in the future.

 

There were also some technical improvements. We upgraded to Solr 1.3, and we are back on a mainline release. Previously we had customized Solr and Lucene to get it to do what we wanted. The new version now provides exactly what we need, so it's going to be easier to upgrade Solr and get bug fixes in the future. Solr 1.3 brings a lot of potential: more flexible config, better performance, runtime index creation/copying and more. Also, our build scripts are now leveraging antlion to provide build avoidance. Now, if the core engine is up to date and you rebuild storefront, you will only rebuild storefront, reducing overall build time considerably.

0 Comments Permalink

The contract negociation went through, the SLA is signed, and as a super-keen developer, you've already downloaded and built Elastic Path within minutes ()! Your heart is racing. The adrenaline is pumping. You just can't wait to start building your ecommerce storefront. With the source code in hand, it's so tempting to start hacking the Elastic Path source code right away.

 

But then you start thinking about the next EP release version, and bug fixes... and you're wondering what you're going to do when it's time to upgrade... How will you manage your customizations while keeping in sync with the most recent stable release of Elastic Path?

 

Maven to the rescue! You can use the power of Maven dependencies and, more importantly, the WAR overlay feature to do this. Overlays are used to share common resources across multiple web applications. Basically, it's a nice and clean way to apply the Decorator pattern to any EP based web applications.

 

How It Works

Step 1. If you don't already have one, install your own Maven repository (Sonatype Nexus, for instance). I won't go into details, but have a look at this old post on TheServerSide.com: Setting Up a Maven Repository.

 

Step 2. Deploy all required libraries shipped with the EP source code in your new Maven repository and build the codebase as per the Developer Guide. When it's done, you should have all applications packaged and ready to be deployed. Depending on your chosen Maven repository, you will need to deploy your different WAR packages (cmserver, searchserver and storefront) by uploading both the WAR binary and the POM file within the project.

 

Step 3. Create a WAR Maven project to hold all the customizations that you want to make on the standard storefront source code (controller, XML configuration, etc.) and specify that you are dependent on EP's Mavenized storefront WAR as follows:

<dependency>
     <groupId>com.elasticpath</groupId>
     <artifactId>com.elasticpath.sf</artifactId>
     <version>6.1.1</version>
     <type>war</type>
</dependency>

 

In your POM project file, add   the Maven Warpath plugin. The Warpath plugin extends the existing war overlay functionality included in the Maven War plugin to turn war artifacts into fully fledged build dependencies. We need it to expose the classes built and contained within the WAR dependency.

<plugin>
     <groupId>org.appfuse</groupId>
     <artifactId>maven-warpath-plugin</artifactId>

     <extensions>true</extensions>
     <executions>
          <execution>
            <goals>
                 <goal>add-classes</goal>
            </goals>
          </execution>
     </executions>
</plugin>

 

While packaging your new extended storefront, all configuration, classes, and libs will be imported from the depending WAR archive into your new web application. The web application "overlay" will work exactly as the original and will be ready for any customization.
Now, let's say you want to override a specific configuration file like WEB-INF/web.xml to declare your extending ContextConfigListener java class. Simply copy locally to your project the WEB-INF/web.xml file and make your modifications. While packaging, the override files will replace all existing configuration files and resources from EP.

 

waroverlay.png

 

WAR overlay gives you full control and dependency management on all your EP customizations. In case of an upgrade or bug fix, all you need to do is rebuild the default EP package and update your project dependency. No more code merge nightmares! No more wondering if you missed any updated configuration files!

 

By combining the WAR overlay approach with Spring framework's plugin capability available within EP, you can override even bean implementation by simply creating your own core extension jar project, having a dependency on the standard EP core jar library, and defining a plugin.xml file within your own jar project. All this has already been proven in the field. You can implement your own storefront without modifying any EP core domain interfaces, services by injection you own implementation.

 

And voila! By leveraging Maven dependency and WAR overlay mechanisms, you have a clean, straightforward approach to implementing EP in the field that keeps the upgrade effort low.

8 Comments Permalink