ASEMON JEAN-PAUL MARTIN May 2015
Agenda What is ASEMON Use cases of ASEMON Features for SAP ASE Installation of ASEMON
What is ASEMON
ASEMON What is Asemon Two components ASEMON is a performance monitoring tool ASEMON is developed and maintained by SAP Principal Consultant Jean-Paul Martin (jean-paul.martin@sap.com) ASEMON helps to monitor the activity of various SAP database solutions like: SAP ASE, SAP IQ, SAP SRS and Replication Agent for ORACLE Two components ASEMON_LOGGER : JAVA based program, collects the activity of the monitored server and records it within a repository ASEMON_REPORT : It is the HTML based GUI of ASEMON
Use cases of ASEMON Server metrics help to: Query metrics help to: Monitor in real time the activity of production database server Focus on performance pain points and investigate performance issues in real time or in forensic situation Retrieve useful performance metrics Compare the activity of servers: within particular timeframes before and after an upgrade or new application software rollout Query metrics help to: Retrieve actual queries and their arguments Retrieve explain plan of queries
More about ASEMON Asemon : First version of ASEMON for SYBASE ASE was delivered in 2004 ASEMON is a best friend of DBAs and developers. It fills the gap between both worlds. ASEMON is used by hundred of people worldwide every day in production, QA or development environments. ASEMON is offered as a GNU General Public License version 2.0. Every week around 50 downloads are observed. The download page is http://sourceforge.net/projects/asemon/
Type of monitored servers Version Counters interfaces SAP ASE 16.0, 15.7, 15.5, 15.0, 12.5.4 MDA interface SAP IQ 12.7, 15.4, 16.0 Catalog views, sp_iqsysmon SAP SRS 12.6, 15.2, 15.6, 15.7 SRS Monitor Counters SAP Replication Agent for ORACLE 15.x RAX counters
Features for SAP ASE
Features for SAP ASE Available report pages for SAP ASE :
Server level information Features for SAP ASE Server level information
SAP ASE : Summary Summary : 1-page for the monitored server activity User CPU utilization System CPU utilization CPU breakout per engine Cache utilization utilization Disk device utilization Network IO utilization Physical IO, Logical IO and CPU breakout per application Number of Users Number of Active Users Procedure cache utilization Stored procedure throughput Procedure cache breakout per module Lock utilization Blocking lock statistics Device statistics breakout table System Wait table Cache statistics table Logs contentions Replication Agents statistics
SAP ASE : Summary Summary : 1-page for the monitored server activity Engines breakout Activity summary CPU utilization
SAP ASE : Summary Summary: 1-page for the monitored server activity Cache Activity Disk Activity Network Activity
SAP ASE : Summary Summary: 1-page for the monitored server activity User connections Active User connections Procedure cache Activity
Procedure cache module SAP ASE : Summary Summary : 1-page for the monitored server activity Stored Procedures throughput Procedure cache module breakout Lock usage
Which table was blocked? SAP ASE : Summary Summary : 1-page for the monitored server activity Procedure cache Modules Statistics Lock situation Analysis Which table was blocked?
Replication Agent Activity SAP ASE : Summary Summary : 1-page for the monitored server activity Transaction Log contention Replication Agent Activity
SAP ASE : Other reports Other server options allow to focus on specific server areas: Objects statistics Cached objects Process activity Locking situations Deadlocks situations Procedures activity (derived from captured statements) Compiled objects activity (procs, dyn. statments, trig…) Fragmentation Sp_sysmon Spinlocks Long running transactions Disk devices activity Statements (long running or in statement cache)
SAP ASE: Process activity Process activity: Lists processes and their resources consumption Limit results as n rows Cumultative CPU consumption Login time of the session Cumultative Logical IO consumption Session ID Cumultative Disk IO consumption User name
SAP ASE : Blocking locks Locks: Lists blocked processes characteristics Lock state: Blocking or Blocked Timestamp of the blocking situation Database of the locked object Blocking duration in second Name of the locked object User name Session ID
SAP ASE : Fragmentation Fragmentation: Lists fragmented tables and indexes Number of Forwarded rows Space utilization Database name Number of Deleted rows Table name Large IO efficiency Data page cluster ratio Index name Locking scheme Index page cluster ratio
SAP ASE : Compiled objects Compiled objects : stored procs, dyn.statements, triggers, … On the right : avgCPUTime sumCPUTime avgLogicalReads sumLogicalReads AvgEexcTime SumExecTime avgPhysicalReads sumPhysicalReads … Nb. Plans seens during the interval Click here for Stored procedure activity history Stored procedure Nb. Of executions Statement in stmt cache
SAP ASE : Statement cache Statement cache : captured statements in statement cache IO statistics per statement Hashkey of statement Nb. executionsl Statement SQL Drill down Click on a row and see statement details, including plan captured in XML
SAP ASE : plans from XML Check this box to see raw XML generated by ASE SQL Text Parameters (first exec and value when plan captured) Statement statistics Plan with optimiser estimates and execution statistics
SAP ASE : sp_sysmon Sp_sysmon: Generates sp_sysmon output Unique feature of ASEMON: ASEMON is able to generate sp_sysmon output after the event
SAP ASE : spinlocks Spinlocks : Generates spinlocks report Spinlock contention % Spinlock name Number of spins Spins per waits ratio Spinlock grabs Spinlock waits
SAP ASE : Long transactions Syslogshold : Lists long running transactions Start time of the transaction Duration of the transaction Session ID
Avg response time for writes Avg response time for reads SAP ASE : Devices Devices : Reports Disk device activity Avg response time for writes Device name Avg response time for reads Physical Reads Physical Writes APF Reads Drill down To drill down for a specific device, just click on its row
SAP ASE : Devices Devices : Drill down specific device activity Throughput for Reads, APF Reads, Writes operations Average Service Time Device Contention % Here you have information for a specific device
Object level information Features for SAP ASE Object level information
SAP ASE : object level information Besides server level information aimed to get a general insight of a database server it is often necessary to drill down on object level for: Specific table Specific statement or stored procedure Specific user process ASEMON offers a very handy interface to drill down to object level and quickly retrieve very relevant and useful information. Examples in next slides.
SAP ASE : Table activity First example : Assume you suspect that your database server performs a lot of physical I/Os. But you do not know what tables are involved and what queries cause these physical I/Os?
SAP ASE : Table activity Objects Stats : Lists tables, indexes information Observation Timeframe Export result set as an Excel spreadsheet Focus on 20 first rows Physical I/Os Database name Logical I/Os Table name Index name Index ID Object information is aggregated for the given observation timeframe. For instance, for the table MSEG (first row in blue) 1,340,871 physical I/Os were performed during the observation timeframe. Tip: Limit the result set to 20 first rows initially. To sort the result set on a particular criteria (physical I/O, logical I/O, rows inserted …) click on the radio button Drill down To drill down for a specific object, just click on its row, for example MSEG table.
SAP ASE : Table activity Objects Stats : Lists tables, indexes information Logical IOs Throughput DATA + INDEX DML operations Throughput Physical IOs Throughput Here you have the drill down information for table MSEG and its indexes.
SAP ASE : Table activity Objects Stats : Lists tables, indexes information Physical IOs For index #2 Physical IOs For index #3 Physical IOs For index #4 Here you have the drill down information for table MSEG and its indexes.
SAP ASE : Table activity Objects Stats : Lists tables, indexes information At the bottom of the page, you have the statements related to the MSEG table. Start time Of the statement Physical IOs Application name Statement line Elapsed time in second Client hostname CPU Time Logical IOs Session ID Procedure name or Statement name Wait Time (disk IO, lock) Plan available ? At the bottom of the page, you will find the statements related to the current table Drill down To drill down for a specific statement, just click on its row.
SAP ASE : Table activity Objects Stats : Lists tables, indexes information Detail information of the statement Start Time Elapsed time [ … ] Cpu Time Wait Time Physical Reads Logical Reads [ … ] Number of affected rows Table information Statement text Here you have execution information of the current statement.
SAP ASE : Table activity Objects Stats : Lists tables, indexes information Table information Statement text SQL Plan Here you have execution information of the current statement.
SAP ASE : Statement activity Second example : Assume you want to check the statements run on the server. You want to focus on long running statements.
SAP ASE : Statements activity Statements: Lists statements information. Duration In second CPU Time Logical Reads Application Name Wait Time Plan available ? Physical Reads Drill down To drill down for a specific statement, just click on its row
SAP ASE : Statements activity Statements: Lists statements information. Cpu Time Wait Time Physical Reads Logical Reads [ … ] Number of affected rows Detail information of the statement Start Time Elapsed time [ … ] Table information Statement text Here you have execution information of the current statement.
SAP ASE : Statements activity Statements: Lists statements information. Table information Statement text Argument values Of the statement Runtime metrics SQL Plan SQL Plan Runtime metrics Here you have execution information of the current statement.
Installation
Download ASEMON ASEMON is available at: http://sourceforge.net/projects/asemon/ Current version is ASEMON 2.7.19 (05 may 2015) Download both components: ASEMON_LOGGER: asemon_logger_V2.7.19.tgz ASEMON_REPORT: asemon_report_V2.7.19.zip or Windows only - bundle of Apache/PHP/ASEMON_REPORT/OpenClient: AsemonReportSRV_V2.7.19.zip
Setting up ASEMON_LOGGER Create a database for archiving the metrics Extract the ASEMON_LOGGER distribution (asemon_logger_V2.7.19.tgz) Fill $SYBASE/interfaces file of the ASEMON_LOGGER host with archive dataserver and monitored dataserver Archive dataserver Monitored dataserver
Setting up ASEMON_LOGGER Create a XML configuration file. You can duplicate sampleConfig.XML template Fill it the XML configuration file: <?xml version="1.0" encoding="UTF-8"?> <Config> [ …] <ArchiveSrv> <name> ASEMON</name> <user> sapsa </user> <useKerberos> NO </useKerberos> <database> asemon </database> <charset> </charset> <GranteeList> </GranteeList> <poolsize> 1 </poolsize> <packet_size> </packet_size> <!-- not mandatory. If defined, overrides default network packet size of the archive server --> <useLongSrvNames> NO </useLongSrvNames> <!-- Put YES here if server names have more than 20 chars and archive server version is V15 or greater --> </ArchiveSrv> <MonitoredSrv> <SRV> <name> PRODUCTION</name> <packet_size> </packet_size> <!-- not mandatory. If defined, overrides default network packet size of the monitored server --> <srvDescriptor> ASE </srvDescriptor> <purgearchive daysToKeep="90" deleteSleep="100" /> </SRV> </MonitoredSrv> Fill the name of the archive dataserver and the name of the login used to archive metrics. Aliased DBO is recommended Fill the name of the monitored dataserver and the name of the collector login. This login must have monrole role.
Running ASEMON_LOGGER Run ASEMON_LOGGER to start the collection and the archiving of the metrics Mention the .XML file $ ./asemon_logger.sh -c ./PRODUCTIONconfig_file.xml 2015/02/19 09:54:23.638 main - Start Asemon_logger Version V2.7.18 2015/02/19 09:54:23.676 main - Current directory is : /work/ASEMON 2015/02/19 09:54:23.676 main - Java version : 1.7.0 2015/02/19 09:54:23.677 main - Classpath is : /work/ASEMON/dist/Asemon_logger.jar:/work/ASEMON/lib/jdom.jar:/work/ASEMON/lib/xerces.jar:/work/ASEMON/lib/java-getopt- 1.0.9.jar:/work/ASEMON/jConnect-7_0/classes/jconn4.jar:/work/ASEMON/jConnect-7_0/classes/jTDS3.jar 2015/02/19 09:54:23.678 main - Config file used : ./PRODUCTIONconfig_file.xml 2015/02/19 09:54:24.657 main - Try to connect to srv : ASEMON 2015/02/19 09:54:24.659 main - Srv found in interfaces or SQL.INI file. Host=asemon_host Port=4901 2015/02/19 09:54:24.659 main - Using password from passwords file for 'ASEMON.sapsa' 2015/02/19 09:54:24.929 main - Connected to archive server : ASEMON Database : asemon 2015/02/19 09:54:24.931 main - Try to connect to srv : PRODUCTION 2015/02/19 09:54:24.932 main - Srv found in interfaces or SQL.INI file. Host=production_host Port=4901 2015/02/19 09:54:24.932 main - Using password from passwords file for 'PRODUCTION.sapsa' 2015/02/19 09:54:25.027 main - connectMonitoredASE - connected to : PRODUCTION Version : 1570 2015/02/19 09:54:25.028 main - Time difference (ms) between ASE and asemon_logger (positive when ASE is in advance) : 69422 2015/02/19 09:54:25.207 PRODUCTION_AmStats - Start thread. 2015/02/19 09:54:25.217 PRODUCTION_AseDbSpce - Start thread. […] 2015/02/19 09:54:25.447 PRODUCTION_WClassInf - Start thread. 2015/02/19 09:54:25.449 PRODUCTION_WEvInf - Start thread. 2015/02/19 09:54:40.320 PRODUCTION_MonSQL - MonSQL BootID = 6 ASEMON_LOGGER will archive metrics within ASEMON.asemon archive database ASEMON_LOGGER monitors PRODUCTION database server. It will run MDA queries against this server. ASEMON_LOGGER starts logger threads. ASEMON_LOGGER is secure. The first time it boots, it will prompt for password of archive dataserver login and the monitored server login. Then ASEMON_LOGGER will stored them encrypted.
Setting up ASEMON_LOGGER Enable Monitoring on ASE via sp_configure "Monitoring“, following required: 'max SQL text monitored' = 2048 (or more) 'enable monitoring' = 1 'object lockwait timing' = 1 'wait event timing' = 1 Setup the environment variables for ASEMON_LOGGER Example for UNIX: JAVA_HOME=/sybase/shared/JRE-7_0_SR4FP2_64BIT export JAVA_HOME PATH=${JAVA_HOME}/bin:${PATH} export PATH http://sourceforge.net/p/asemon/wiki/Asemon%20lo gger%20installation/
Setting up ASEMON_REPORT Easiest way is to run ASEMON_REPORT on Windows Extract the ASEMON_REPORT distribution AsemonReportSRV_V2.7.19.zip on C:\AsemonReportSRV This distribution contains an embedded Apache HTTP server Update C:\AsemonReportSRV\SYBASE\INI\SQL.INI with the name of the archive server Archive dataserver
Run ASEMON_REPORT Update the setup.bat (if needed) Execute “setup.bat” Run ASEMON_REPORT: startApache.bat :
Run ASEMON_REPORT Open a browser, connect to ASEMON URL Monitored dataserver Archive dataserver Archive database The default ASEMON URL is here: http://127.0.0.1/asemon_report/asemon_report.php But you can update the httpd.conf file to change the Listen attribute of Apache