Mail to Send on Account Creation ,password reset and confirm password to the end user in AEM 6.4

Solution :









  • To change the email id and other details in CRXDE level, key in this path in the search path: /etc/security/accountmgr/jcr:content/requestnewaccount

Request Log Analyzer to find the top 10 expensive queries in AEM 6.4

Statement : Analyzes the current request log in order to identify the most expensive requests in a given period.

Solution :

                - The last number of hours from now to be analyzed - Enter the hours since when
                 - Limit output to the specified number of lines. 
                 - Analyze up to the specified number of requests (-1 meaning all)



  •  You can run the request log analyzer on daily basis to check the expensive requests and have automated mail alert to email box , Make sure SMTP is configured to receive the mail alerts of the request log report
  •  Also you can configure the run time of script on daily basis for auto run and get the automated email.
  • Below screenshot shows the top expensive queries and further you can investigate on these queries as required


  • If you don't configure the SMTP and trying to configure your email id for auto alert. you will see the below error. make sure SMTP is configured.
  • Request to Analyze 10 request for first 1 hour as show in the below screenshot.






Use of Validate feature in Package manager console of AEM during package deployment

Solution :
A new Validate feature is introduced for the package manager installation.


How to cehck status of AllQueues in AEM through JMX console

Statement - All Queues Status

Solution :

  • Status of All Queues :



Attributes
Attribute Name
Attribute Value
Name
All Queues
StartDate
2018-06-07T13:56:03+0800
LastActivatedJobDate
2018-06-19T09:47:06+0800
LastFinishedJobDate
2018-06-19T09:47:07+0800
StartTime
1528350963598
NumberOfJobs
2
LastActivatedJobTime
1529372826865
NumberOfActiveJobs
2
NumberOfCancelledJobs
8
NumberOfFinishedJobs
53
AverageWaitingTime
102784728
LastFinishedJobTime
1529372827327
NumberOfFailedJobs
871
NumberOfProcessedJobs
932
AverageProcessingTime
3075922
NumberOfQueuedJobs
0

Operations
Return Type
Name
void
reset()
Operation exposed for management


  • Screenshot for Queue status :


How to automate the Offline compaction process in AEM 6.2

Statement  : Automate the offline compaction process.


Solution :

  • For Offline compaction is still applicable for AEM 6.2 but AEM 6.3 is not required beacuse it spports online compaction.
  • Below is the steps involved in the automation and script which is used automates entire process.

Steps involved in the Offline compaction Automation :

  1. Shutdown AEM Server
  2. Use Matching Oak jar version to find Old Checkpoints
  3. Use Matching Oak jar version to Remove Unreferenced Checkpoints
  4. Use Matching Oak jar version to Compact Oak
  5. Restart AEM
SCRIPT:
#!/bin/bash
todayDate="$(date +'%d-%m-%Y')"
logfile="compact-$ todayDate.log"
installfolder="/data/aem"
aemfolder="$installfolder/crx-quickstart"
oakrun="$installfolder/help/oak-run-1.6.1.jar"

## Shutdown AEM
printf "Shutting down AEM.\n"
$aemfolder/bin/stop
todayDate ="$(date)"
echo "AEM Shutdown at: $ todayDate " >> $installfolder/help/logs/$logfile

## Find old checkpoints
printf "Finding old checkpoints.\n"
java -Dtar.memoryMapped=true -Xms8g -Xmx8g -jar $oakrun checkpoints $aemfolder/repository/segmentstore >> $installfolder/help/logs/$logfile

## Delete unreferenced checkpoints
printf "Deleting unreferenced checkpoints.\n"
java -Dtar.memoryMapped=true -Xms8g -Xmx8g -jar $oakrun checkpoints $aemfolder/repository/segmentstore rm-unreferenced >> $installfolder/help/logs/$logfile

## Run compaction
printf "Running compaction. This may take a while.\n"
java -Dtar.memoryMapped=true -Xms8g -Xmx8g -jar $oakrun compact $aemfolder/repository/segmentstore >> $installfolder/help/logs/$logfile

## Report Completed
printf "Compaction complete. Please check the log at:\n"
printf "$installfolder/help/logs/$logfile\n"

## Start AEM back up
todayDate ="$(date)"
printf "Starting up AEM.\n"
$aemfolder/bin/start
echo "AEM Startup at: $ todayDate " >> $installfolder/help/logs/$logfile

Reference :
https://jackrabbit.apache.org/oak/docs/command_line.html


How to find Popular and Slow Queries in AEM through JMX console

Statement - Popular and Slow Queries in AEM through JMX console
Environment - AEM 6.3 GA

Solution :

  • Top 15 Slow Queries tweak slow queries/rewrite slow queries for better performance or create indexes for those slow queries.


  • Below is the screenshot to clear popular and slow queries, Click on each of the below Operation and click on invoke.

  • That's  it!

Oak QueryEngine Optimization Parameters and how to set these parameter in JMX console in AEM

Statement - Query engine Optimization parameters
Environment - AEM 6.3 GA

Solution :
Attributes
Attribute Name
Attribute Value
LimitInMemory
500000
LimitReads
100000
FailTraversal
true
FastQuerySize
false

  • Click on  each of these attribute value to increase/decrease as shown in below.

  • To return the query result size should return an estimation for large queries set the FastQuerysize to True
  • Set FailTraversal to True Whether queries that don't use an index will fail (throw an exception) as shown in below screenshot.
  • That's  it!

Heap Dump Generation in AEM through JMX console

Statement - Heap Dump generation
Environment - AEM 6.3 GA

Solution :

  • Check the test1.prof parallel to the crx-quickstart folder.
  • That's  it!

Java VM Daignostic commands to run GC, Finalization,vmSystemProperties,vmVersion,vmUptime and vmCommand line

Statement - Java VM Diagnostic command
Environment - AEM 6.3 GA

Solution :
Operations
Return Type
Name
java.lang.String
gcClassHistogram([Ljava.lang.String; arguments)
Provide statistics about the Java heap usage.
java.lang.String
gcClassStats([Ljava.lang.String; arguments)
Provide statistics about Java class meta data. Requires -XX:+UnlockDiagnosticVMOptions.
java.lang.String
gcRotateLog()
Force the GC log file to be rotated.
java.lang.String
gcRun()
Call java.lang.System.gc().
java.lang.String
gcRunFinalization()
Call java.lang.System.runFinalization().
java.lang.String
help([Ljava.lang.String; arguments)
For more information about a specific command use 'help '. With no argument this will show a list of available commands. 'help all' will show help for all commands.
java.lang.String
jfrCheck([Ljava.lang.String; arguments)
Checks running JFR recording(s)
java.lang.String
jfrDump([Ljava.lang.String; arguments)
Copies contents of a JFR recording to file. Either the name or the recording id must be specified.
java.lang.String
jfrStart([Ljava.lang.String; arguments)
Starts a new JFR recording
java.lang.String
jfrStop([Ljava.lang.String; arguments)
Stops a JFR recording
java.lang.String
threadPrint([Ljava.lang.String; arguments)
Print all threads with stacktraces.
java.lang.String
vmCheckCommercialFeatures()
Display status of commercial features
java.lang.String
vmCommandLine()
Print the command line used to start this VM instance.
java.lang.String
vmFlags([Ljava.lang.String; arguments)
Print VM flag options and their current values.
java.lang.String
vmNativeMemory([Ljava.lang.String; arguments)
Print native memory usage
java.lang.String
vmSystemProperties()
Print system properties.
java.lang.String
vmUnlockCommercialFeatures()
Unlock commercial features
java.lang.String
vmUptime([Ljava.lang.String; arguments)
Print VM uptime.
java.lang.String
vmVersion()
Print JVM version information.

  • That's  it!

How to clear blocked queue or forced-to retry blocked queue in AEM through JMX console

Statement - How to clear and force retry blocked queue
Environment - AEM 6.3 GA

Solution :



  • Go to the Felix console URL: http://localhost:4502/system/console/jmx
  • Search for publish agent as shown in below screenshot
  • Open the Publish agent and you can validate whether the queue is blocked or not,If queue is blocked, you can see the no of items blocked in queue as per the screenshot.
  • you can see there are 4 items blocked in queue, Click on the queueCLear() method --> Click on Invoke to clear the blocked queue and reffresh the console post click on invoke as shown in below screenshot.

  • That's  it!