Tuesday, 5 November 2019

Composum with AEM

What is Composum?

Composum is an Open-Source project based on Apache Sling, which is a set of useful tools and a
framework to work with Apache Sling framework easily

Modules of Composum: Nodes, Pages, Assets, Platform

Composum Platform:
This is the central services to set up an Apache Sling based application platform

Composum Pages:
Pages provides the content management feature of the Composum platform

Composum Assets:
This is the image asset management feature of the Composum

Composum Nodes:
Resource/JCR development tool with core API for all Composum modules.

Use case with AEM: Composum helps to create a diagram representation of the OSGI service dependencies

Demo video can be found here - Composum with AEM

Thursday, 10 October 2019

Stress test the AEM capability using Tough day 2


What is 'Tough day 2'?
In real scenarios we need to stress test the AEM to find out its limits. Tough day 2 is a tool provided by Adobe to stress test AEM instances.
It has default test suite or can be customized as per needs to run various stress tests in AEM.

How do we get the Tough Day 2 Application?

We can get it from Adobe Repository

How to run the Tough Day 2?

We need to run the Tough Day 2 jar using below command; where localhost is the host where AEM is running.

java -jar toughday2.jar --host=localhost


How to get help?
To enable the Help, run Tough day 2 using below command,
java -jar toughday2.jar --help_full

What are the default test options available for Tough day 2?

Some of the default cases are given below,
1) Getting the Home page
2) Triggering the queries in Query builder
3) Delete the assets from DAM
4) Create pages
5) Create live copies and run roll outs

Can we customize Tough Day 2?
Yes as mentioned previously, we have complete customization option here. We can do it by either providing command line parameters or yaml configurations. Command line has the highest priority, which means, it can override the configuration files or default parameters.
Configuration files has the second priority, which can override the default configurations.
Remember this, configuration files are used for large custom suites to make it easier.

What are all the various run modes available in Tough Day 2?

1) Normal: This generates constant number of threads. It has 2 params
    a) Concurrency
    b) waittime

2) Constant Load:This generates constant number of started test executions.

How do we analyze Test Day 2 Output?

The output of Test Day 2 consists of logs and test metrics(9 of them).

Test Metrics
The test metrics are available in CSV (CSVPublisher), and in console (ConsolePublisher ) form.
 
Logs
The logs are also created under same folder of Tough Day 2 installation.
2 Files are created,
  a) generic(toughday.log)- all generic & global messages
  b) custom(toughday_<testname>.log) - related to our specific test

Do we need load test in AEM Authoring instance?


In usual scenarios, the Author performance has been less of a problem in most cases. But the number of concurrent users and the size of the assets are the biggest factors in sizing the author. The general practice is load-test content authoring workloads only when a) number of content authors is high (>50) AND b) they use AEM ASSETS.

Load test is done using Tools like JMeter(Author/Publish instance in our Jenkins pipeline), LoadRunner etc. Recommendation is always to test with production size content! AEM author will not have less number of pages w.r.t production( For e.g. 10 pages vs 100.000+ pages are a big change to compare)

Summary:
The test suite comprise of 85% read and 15% write. When we install and run Tough Day 2, it installs all the content packages, which can be avoided by passing parameters while load run.
The parameters list can be found here for AEM 6.5

Since Tough Day 2 once run cannot clean up the things from AEM by itself, it is always recommended to run Tough day on a cloned AEM instance.

Monday, 26 August 2019

Locally compile 3rd party bundles which are not available in public repository.



Some times I have seen, we may need some of the bundles latest version which are available in AEM but same version is not available in maven public repository or Adobe nexus repository. Here we will see how to get the bundle locally and compile it.

First Step -
if the third party bundle is in your local AEM server,

Getting bundle from AEM and install it in our local maven repository-

When you notice a bundle is available in AEM servers system >console >bundle, the AEM installed folder will have the same bundle in disk.

First of all you identify the bundle id from AEM system console as shown below.


Click on image to see it big


To find the same bundle in local disk, go to
AEM Installed folder\crx-quickstart\launchpad\felix\bundle<id>)


Click on image to see it big


Now copy this bundle to a location (for e.g C:)


Second Step: Next step is installing it in our local maven repository. Open the command prompt in c:

The syntax for installing the bundle in local repository is
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

Actual command used:
mvn install:install-file -Dfile=bundle.jar -DgroupId=org.apache.jackrabbit -DartifactId=jackrabbit-api -Dversion=2.18.0 -Dpackaging=jar

Now you will have the dependency bundle in your local maven repsotory and your code will compile without issues.

Tuesday, 16 July 2019

AEM with GraphQL

In this post we will analyze the ways we can use AEM with GraphQL and the advantages.

GraphQL is becoming a trend setting tool to query the response now. There are some cons with traditional way of using API calls.

The difference between GraphQL and API

Usually an API response dumps all the information passed from the third party back-end. But when we use GraphQL we can just query only the required relevant there by the data transfer load is less.

AEM as back-end with GraphQL:
Here AEM Content will be exposed as an API using content/ assets API and GraphQL queries the response and send the relevant response to any third party application like REACT or Angular.


Sample use case:
In my test scenario, I had created a content fragment in AEM and exposed over an http API. I have a GraphQL layer deployed on a stand alone Node JS and this GraphQL queries the Content Fragment API for relevant information. This data was then send to REACT application for display purpose.

AEM for content display from third party system:

In this case GraphQL queries any third party system and send the relevant information to AEM.
Sample use case: I have a Facebook API to retrieve a set of information from Facebook and it was then filtered through GraphQL and then send to AEM.


What Next?
I will come up with GraphQL Setup +  AEM Integration with GraphQL in my upcoming tutorials. Keep watching this page for more.
 

Thursday, 20 June 2019

Use of Media Handlers with AEM workflows to process Assets

In AEM projects, there are cases we may need to create pdf or png form of an html page for preview purpose. Media Handlers are a good help here. By using Media Handlers  we can process the AEM assets easily. Once configured, during asset uploads, the asset gets processed using either AEM provided handlers or command line tools.

Click on image to see it big


What is media Handlers?
They are services internal to AEM Assets that perform specific actions on assets. They work hand in hand with Workflows. The Media Handlers extract all available metadata from an asset; it has also capability of creating a thumbnail image.

Enable/ Disable

By default all the available Media Handlers are enabled. To disable them , just click on the disable button.

Go to http://localhost:4502/system/console/components to see all media handlers.

Some of the examples could be TextHandler, JpegHandler, PdfHandler etc

Read More about how to configure Media Handlers : https://helpx.adobe.com/experience-manager/6-3/assets/using/media-handlers.html

Below given two articles which shows how to generate image and PDF of a webpage.

AEM 6.5 - Generate Image of HTML files uploaded to DAM

AEM 6.5 - Workflow step to generate PDF of Sites page during Activation (Publish)

More Like This:

AEM 6.5 Site related new features

AEM 6.5 Specific new features in Assets section

New Features in AEM 6.5 Forms

Foundation updates in AEM 6.5 which a developer should be aware of

Cloud Manager for AEM 6.5 New features


Storage concepts in AEM 6.5   

HTML Template language updates which needs to be observed with AEM 6.5


Saturday, 8 June 2019

What is Configuration Browser in AEM?

Developers follow the approach given by Adobe to work with Editable Templates, ContextHubs and Content Fragments. But many are not sure the reason behind why there needs to be configuration browser for AEM.

We have given a video explaining what is configuration browser, why it is required and if we dont create / configure it how it affects the AEM Site.




More Like This:

AEM 6.5 Site related new features

AEM 6.5 Specific new features in Assets section

New Features in AEM 6.5 Forms

Foundation updates in AEM 6.5 which a developer should be aware of

Cloud Manager for AEM 6.5 New features


Storage concepts in AEM 6.5   

HTML Template language updates which needs to be observed with AEM 6.5

Tuesday, 4 June 2019

AEM Site Performance Issues - Root Cause - Analysis - How to Fix

When we say the AEM site performance is hit?

Once the production deployment of an AEM site is done, and if we find slowness in any of the things like pages are loading slow, creation or editing of pages are slow, AEM response times are not fair, AEM is not responding to some requests,  request.log on AEM shows slow response times etc. we can assume there is some issue with the performance of the site.



Common reasons for slow performance

Below given some of the possible reasons for AEM site performance issues;
  • Improper design - Not a deeply though solution
  • High CPU utilization due to long running requests such as slow searches, write-heavy background jobs, moving the whole branches of site content, etc.
  • Application code - Error prone code
  • Memory Issues - Not an efficiently written
  • Insufficient server sizing or incorrect architecture - For a huge site, we did not use mult author multi pubish setup
  • Indexing Issues - Not done a proper indexing
  • Lack of caching - No efficient caching
  • Wrong disk I/O configuration - Improper infra configuration
  • Memory sizing - Not used enough memory
  • Network bandwidth and latency - Not having proper bandwidth allocated
  • Replication Issues - Improper configuration which leads to blockage
  • Ineffective or inadequate maintenance
  • Lack of a Content Delivery Network

How do we analyze the root cause of a performance issue?
  • Check CPU utilization for any AEM process eating much memory
  • Study the request.log file for detailed data
  • Collect thread dumps and analyze them
  • Workflow checks, version checks, audit checks
  • Analyze caching strategies implemented at the AEM dispatcher
  • Check maintenance related to Oak repositories
  • Validate asset guidelines
  • Check indexing and review the jcr queries for 1. Poorly restricted (or scoped) queries 2. Large result set queries 3. Index-less queries

Some of the Tools for validating and fixing AEM performance:

  • JMX Console in AEM : Enables you to monitor and manage services on the CRX server.
  • JConsole : that comes with JDK - helps to find memory leaks, thread deadlock etc.
  • Any other profilers : like YourKit(CPU and memory profiling tool) which recommends the better usage of code
  • Memory analyzer tool - MAT :  Eclipse's MAT is a set of plug-ins for the Eclipse IDE. Helps for heap dump analysis & memory problems in the application
  • Apache Bench : Helps to identify memory leaks, selectively analyze response time.
  • JMeter : Load and functional tests.
  • JProfiler : In-depth CPU and memory profiling.
  • SonarQube : A code validation tool for better code

How to make sites perform better?
  • Ensure you are carrying out regular maintenance
  • Improve back-end service calls to a fail safe state.
  • Optimize AEM client libraries - Embed client libraries, Minify them
  • Cache JavaScript and CSS for long periods of time
  • Optimize Indexes so that querying works better
  • Modify the jcr queries to scope limited and efficient.
  • Install the recommended AEM service packs, cumulative fix packs and hot fixes:
  • Follow the Assets best practices.
  • Allocate enough RAM to avoid IO saturation
  • Enable transient workflows - this avoids manual purging of workflows
  • Tune the Oak Repository as per best practice

Hold on; Before you go for any big changes as part of performance improvements, have a backup plan, Disaster recovery plan do itfirst before you try to fix the performance.

More Like This:

AEM 6.5 Site related new features

AEM 6.5 Specific new features in Assets section

New Features in AEM 6.5 Forms

Foundation updates in AEM 6.5 which a developer should be aware of

Cloud Manager for AEM 6.5 New features


Storage concepts in AEM 6.5   

HTML Template language updates which needs to be observed with AEM 6.5