SlideShare ist ein Scribd-Unternehmen logo
1 von 38
WSO2 Stratos - Tenent CPU
    usage metering

    Lasindu Charith Vidana Pathiranage
          University of Moratuwa
Outline

1. Requirements

2. Implementation

3. Demo

4. Problems

5. Things Learnt

6. Q & A
Current implementation for tenant usage
     metering and billing in Stratos


         ✔   Number of users

         ✔   Disk Storage

         ✔   Bandwidth usage

         ✗   CPU Usage ???
What are the available CPU usage
      metering methods ?
       ●
           Per Hour
       ●
           Per Instance        Fixed Rate
       ●
           Per User
       ●
           Per Tenant Request ??
Outline

1. Requirements

2. Implementation

3. Demo

4. Problems

5. Things Learnt

6. Q & A
Java ThreadMXBean to rescue..
●
    The management interface for the thread system
    of the JVM.

●
    Java virtual machine implementation supports
    measuring the CPU time for the current thread
    or for any thread.

●
     getCurrentThreadCpuTime() Returns the total
     CPU time for the current thread in nanoseconds.

●
     Does not account for thread sleep/idle time.
Sample Code Usage
if (Metering is enabled) { //check the system property   (carbon.xml)

if(tenant!= carbon.super && context equals “services” or “webapps”) {

startCpuTime=threadMXBean.getCurrentThreadCpuTime() //get thread cpu time

    }

}

//Executable code

if (Metering is enabled) {

if(tenant!= carbon.super && context equals “services” or “webapps”) {

endCpuTime = Get thread Cpu time

threadCpuTime = (endCpuTime – startCpuTime)/1000000    //to milliseconds

if(threadCpuTime> 0) Add cpuStatisticsEntry to Queue

    }

}
CPU time of requests passing through
                  Tomcat to ODE


Thread Pool
                 Request

 Request                                        BPEL
                Response        Axis 2        Component

              Tomcat Valves


                                                        Invoke
               Tomcat Servlet Transport                  (Job)

                                          Apache ODE
                                                          Internal
                                                        Thread Pool


                                            Scheduler
                                             Simple
ESB CPU Time …
           Synapse


             Proxy Service
               In Sequence
                Class
                                    Endpoint
               Mediator


                                               Service
Consumer                  ServerWorker         Provider

               Out Sequence

                      Class
                     Mediator




                          ClientWorker
How it works ??
 Thread Execution Component

  CpuUsageStatisticsContainer

                                              CpuUsageStatistics
                                   Retreive   retrieval Component
CpuUsageStatisticsEntries Queue




 Thread CPU Time per Request                         Send




                                                     Existing
    (To be used for Billing       Publish     Stratos Usage Agent
       and Throttling)                             Component
Usage Agent -> BAM



                                 Publish
    Usage Agent Component



                            Usage
                < tenantID, measurement, value >




            Bandwidth        Database          CPU
             Usage            Usage           Usage
Overall Architecture
BpsCpuUsageStatisticsContainer
                                                 Data Retriever         <CpuUsageStatisticsEntry>


                                          BPS Usage Agent Component
                               <<send>>                                      SimpleScheduler
      PublisherUtils

                                                                                   ode

     Data Persister
                               <<send>>
                                                 Data Retriever       EsbCpuUsageStatisticsContainer
                                                                        <CpuUsageStatisticsEntry>
     Data Retriever
                                          ESB Usage Agent Component
                                                                       ServerWorker      ClientWorker
       Stratos Usage
           Agent
                                                                               synapse-nhttp-
                                                                                  tranport
       <<retrieve>>

                                                                       CpuUsageStatisticsContainer
                                              New Agent Component       <CpuUsageStatisticsEntry>
TransportStatisticsContainer
<CpuUsageStatisticsEntry>


                                                                             ThreadMXBean
CarbonStuckThreadDetection
          Valve
                                            Extensible                 Cpu Time Capturing Component

      Tomcat Ext
Why different … ??

✔   Every Request does not go through Tomcat
    servlet transport (eg: ESB uses nhttp requests)
✔   Some products uses their internal thread pools
    and thread execution mechanisms. (eg : BPS
    uses Apache Ode & ESB uses Apache Synapse)
✔   BAM script execution is handled by a separate
    JVM
Solution

✔   Specifically capture the CPU time for the products
    which has above constraints.
✔   Separate Component to retrieve product specific
    CPU Usage Statistics and send them to Stratos
    Usage Agent Component.
✔   Should add CPU Statistics to the same Usage
    Agent instance, once it is registered as an OSGI
    Service.
How to use tenant CPU usage Statistics

      Metered CPU Statistics will be summarized in BAM.

      Data will be used for billing and throttling.

      Tenants will be throttled and billed at the end of the
      month according to their CPU usage.




             Summarized Data in BAM using a Hive Script
How they all fit - in …???
                           er             Throttling
                 st to Serv
            Reque                           Agent




   Client
                                Metering Data
                                    Store


                                                       Mediator Agent
                                                        ( Optional )




  Server                         Usage Agent
Outline

1. Requirements

2. Implementation

3. Demo

4. Problems

5. Things Learnt

6. Q & A
Demo
✔   CPU time for a            ✔   Remotely debug for
                                  correctness
     •
         Sample Web-service
                              ✔   Summarize data at BAM
     •
         BPEL Process
                                  side
     •
         ESB Proxy Service
Outline

1. Requirements

2. Implementation

3. Demo

4. Problems

5. Things Learnt

6. Q & A
Problems
[1] Products are different
    
        Thread handling is done differently in some
        products. Had to remotely debug each an every
        product's dependent apache code
        (ode/synapse/hive/hadoop) and find the thread
        execution part and capture the CPU time of each
        request
    
        Usually tenant information is not associated with
        each request/response in apache code. I had to
        send the tenant domain/id in certain cases as a
        parameter in the invoke method from the particular
        component or set it as a property so that I could
        find which request comes from which tenant.
Problems Continued ..
[2] Retrieving data from different dependencies
     
         Cannot add direct dependencies to ode/synapse
         in Stratos usage agent component since it is not
         used in every WSO2 product. I had to write new
         component to do the data retrieval/persistence
         tasks for each product, where I had to capture
         CPU time, except for Tomcat.ext
     
         Had to register UsageDataPersistenceManager in
         usage agent as an OSGI service, so that
         ESB/BPS components can add the CPU usage
         data to the same instance that is used by the
         org.wso2.carbon.usage.agent component's
         persistence queue.
Problems Continued ..

[3] Accurate CPU Usage data ..??
     
         Request execution live time and CPU time are very
         close values, but CPU time is less than the live
         time.
     
         Thread sleep time is not captured as CPU time.
     
         Thread CPU time is aggregated in ThreadMXBean.
         Had to take the difference of thread CPU time
         always for a particular request.
Problems Continued ..
[4] Performance Hit ...??
     
         EnableMetring is set to 'false' by default in
         carbon.xml. CPU time measuring code is executed
         only if metering is enabled.
     
         Tested for Tomcat.ext after metering is enabled.
         No noticeable change in SOAPUI for a of web
         service call burst.
     
         Tested for several types of ESB proxy services
         with and without code from Apache Jmeter and
         there is no sign of change in TPS.
Performance Comparison with Apache Jmeter
                     ESB Echo Proxy Service – 1000 Samples
            No of Threads : 100 Ramp-up period : 5s Loop Count : 10

                Average   Median   90% Line   Min   Max   Error   Throughput
                   3        3         6       2     26    0.0%    199.7/sec
                   3        3         6       2     18    0.0%    199.4/sec
Without Code       3        2         6       2     34    0.0%    199.6/sec
                   2        2         6       2     32    0.0%    199.3/sec
                   3        2         6       2     22    0.0%    199.7/sec


                Average   Median   90% Line   Min   Max   Error   Throughput
                   4        3         7       2     38    0.0%    199.1/sec
With Code          3        3         6       2     21    0.0%    199.3/sec
                   3        3         6       2     38    0.0%    199.6/sec
                   3        3         6       2     21    0.0%    199.5/sec
                   2        3         6       2     25    0.0%    199.0/sec
Performance Comparison with Apache Jmeter
                    ESB Echo Proxy Service – 1000 Samples
            No of Threads : 50 Ramp-up period : 5s Loop Count : 20

                Average   Median   90% Line   Min   Max   Error   Throughput
                   3        3         4       2     19    0.0%    199.0/sec
                   3        3         4       2     13    0.0%    198.8/sec
Without Code       3        3         4       2     21    0.0%    197.5/sec
                   2        3         4       2     12    0.0%    199.0/sec
                   2        3         3       2     19    0.0%    199.3/sec


                Average   Median   90% Line   Min   Max   Error   Throughput
                   4        3         7       2     29    0.0%    196.9/sec
With Code          4        3         7       2     22    0.0%    199.3/sec
                   4        3         7       2     21    0.0%    199.5/sec
                   3        3         6       2     22    0.0%    198.1/sec
                   2        3         3       2     17    0.0%    199.2/sec
Performance Comparison with Apache Jmeter
          ESB Proxy Service (Class mediator) – 1000 Samples
       No of Threads : 100 Ramp-up period : 1s Loop Count : 10

                         Without      With
                          Code        Code
                        760.5/sec   766.8/sec
                        762.2/sec   749.1/sec
                        754.1/sec   746.8/sec
                        745.2/sec   746.3/sec
                        751.9/sec   751.3/sec
                        763.4/sec   748.5/sec
                        764.5/sec   757.6/sec
                        753.6/sec   749.6/sec


– Checked out for several types of Proxy services at the same
  time and total throughput seems to be quite even.
Problems Continued ..

[5] Product/version problems

     
         Different Products used different versions of the
         same component
     
         While project goes on several changes to
         dependent components occurred
Outline

1. Requirements

2. Implementation

3. Demo

4. Problems

5. Things Learnt

6. Q & A
Automation Hackathon


    With GREG team for almost 2 months.

    Wrote a lot of test cases and ported old tests to
    Clarity framework.

    Learnt on Greg LCs, Rxts, APIs, URIs, Handlers,
    Permissions etc.

    Learnt to writie axis2 clients to test CRUD Operation
    support and Discovery Proxy for GREG.

    Automated several Support Patches.
Technical Knowledge
Above them all ...


    Obviously learnt a load of technical things.

    How to take important architectural decisions and
    flexibility of carbon architecture.

    How to Communicate ideas with others and get the
    necessary help.

    Was able to get the help of lot of people and work in
    several products Carbon, AS, ESB, BPS, GREG,
    BAM, DSS, Stratos etc.

    Learnt best practices in software engineering and
    coding conventions.
Above them all ...


    How to test software, automate the functionality and
    how QA functions.

    How to use mailing lists effectively.

    How to manage time and meet deadlines.

    How does a company function and how a company
    prepares for a release.

    Got to know a bunch of good friends/people.

    Enjoyed every minute of it.
Outline

1. Requirements

2. Implementation

3. Demo

4. Problems

5. Things Learnt

6. Q & A
Questions ..?
References


    http://maharachchi.blogspot.com/2011/08/metering-
    throttling-and-billing-in.html

    http://sanjeewamalalgoda.blogspot.com/2011/08/wso2-
    stratos-usage-and-throttling_22.html

    http://wso2.org/library/articles/2011/11/usage-metering-
    cloud-environment-using-wso2-stratos

    http://docs.oracle.com/javase/6/docs/api/java/lang/manage
    ment/ThreadMXBean.html

    http://jmeter.apache.org
Thank you !!

Weitere ähnliche Inhalte

Was ist angesagt?

Do Theoretical Flo Ps Matter For Real Application’S Performance Kaust 2012
Do Theoretical Flo Ps Matter For Real Application’S Performance Kaust 2012Do Theoretical Flo Ps Matter For Real Application’S Performance Kaust 2012
Do Theoretical Flo Ps Matter For Real Application’S Performance Kaust 2012Joshua Mora
 
Virtual Machine Incorporated Sharing Model for Resource Utilization
Virtual Machine Incorporated Sharing Model for Resource UtilizationVirtual Machine Incorporated Sharing Model for Resource Utilization
Virtual Machine Incorporated Sharing Model for Resource Utilizationidescitation
 
Session 49 - Semantic metadata management practical
Session 49 - Semantic metadata management practical Session 49 - Semantic metadata management practical
Session 49 - Semantic metadata management practical ISSGC Summer School
 
Lvs mini-howto
Lvs mini-howtoLvs mini-howto
Lvs mini-howtoSanjib Dey
 
Awrrpt 1 3004_3005
Awrrpt 1 3004_3005Awrrpt 1 3004_3005
Awrrpt 1 3004_3005Kam Chan
 
Memcachedb: The Complete Guide
Memcachedb: The Complete GuideMemcachedb: The Complete Guide
Memcachedb: The Complete Guideelliando dias
 
LXF #102 - Linux Virtual Server
LXF #102 - Linux Virtual Server LXF #102 - Linux Virtual Server
LXF #102 - Linux Virtual Server guest69bec2
 
Lightweight Grids With Terracotta
Lightweight Grids With TerracottaLightweight Grids With Terracotta
Lightweight Grids With TerracottaPT.JUG
 
Alibaba cloud benchmarking report ecs rds limton xavier
Alibaba cloud benchmarking report ecs  rds limton xavierAlibaba cloud benchmarking report ecs  rds limton xavier
Alibaba cloud benchmarking report ecs rds limton xavierLimton Xavier
 
자바 성능 강의
자바 성능 강의자바 성능 강의
자바 성능 강의Terry Cho
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunningguest1f2740
 

Was ist angesagt? (16)

Do Theoretical Flo Ps Matter For Real Application’S Performance Kaust 2012
Do Theoretical Flo Ps Matter For Real Application’S Performance Kaust 2012Do Theoretical Flo Ps Matter For Real Application’S Performance Kaust 2012
Do Theoretical Flo Ps Matter For Real Application’S Performance Kaust 2012
 
Cosbench apac
Cosbench apacCosbench apac
Cosbench apac
 
Virtual Machine Incorporated Sharing Model for Resource Utilization
Virtual Machine Incorporated Sharing Model for Resource UtilizationVirtual Machine Incorporated Sharing Model for Resource Utilization
Virtual Machine Incorporated Sharing Model for Resource Utilization
 
Session 49 - Semantic metadata management practical
Session 49 - Semantic metadata management practical Session 49 - Semantic metadata management practical
Session 49 - Semantic metadata management practical
 
Lvs mini-howto
Lvs mini-howtoLvs mini-howto
Lvs mini-howto
 
Awrrpt 1 3004_3005
Awrrpt 1 3004_3005Awrrpt 1 3004_3005
Awrrpt 1 3004_3005
 
Memcachedb: The Complete Guide
Memcachedb: The Complete GuideMemcachedb: The Complete Guide
Memcachedb: The Complete Guide
 
Session9part2 Servers Detailed
Session9part2  Servers DetailedSession9part2  Servers Detailed
Session9part2 Servers Detailed
 
LXF #102 - Linux Virtual Server
LXF #102 - Linux Virtual Server LXF #102 - Linux Virtual Server
LXF #102 - Linux Virtual Server
 
Lightweight Grids With Terracotta
Lightweight Grids With TerracottaLightweight Grids With Terracotta
Lightweight Grids With Terracotta
 
Alibaba cloud benchmarking report ecs rds limton xavier
Alibaba cloud benchmarking report ecs  rds limton xavierAlibaba cloud benchmarking report ecs  rds limton xavier
Alibaba cloud benchmarking report ecs rds limton xavier
 
Prdc2012
Prdc2012Prdc2012
Prdc2012
 
Linux PV on HVM
Linux PV on HVMLinux PV on HVM
Linux PV on HVM
 
자바 성능 강의
자바 성능 강의자바 성능 강의
자바 성능 강의
 
Session18 Madduri
Session18  MadduriSession18  Madduri
Session18 Madduri
 
Jvm Performance Tunning
Jvm Performance TunningJvm Performance Tunning
Jvm Performance Tunning
 

Andere mochten auch

Weave-D - 2nd Progress Evaluation Presentation
Weave-D - 2nd Progress Evaluation PresentationWeave-D - 2nd Progress Evaluation Presentation
Weave-D - 2nd Progress Evaluation Presentationlasinducharith
 
Grammarhandbook semester 2 sp3h
Grammarhandbook semester 2 sp3hGrammarhandbook semester 2 sp3h
Grammarhandbook semester 2 sp3hZach Sanchez
 
El día de los muertos document
El día de los muertos documentEl día de los muertos document
El día de los muertos documentZach Sanchez
 
台東中小企業課講座
台東中小企業課講座台東中小企業課講座
台東中小企業課講座Martin Lin
 
Actividad 2 (permanente)
Actividad 2 (permanente)Actividad 2 (permanente)
Actividad 2 (permanente)AlbaPelirroja
 
NBQSA 2nd round Presentation
NBQSA 2nd round PresentationNBQSA 2nd round Presentation
NBQSA 2nd round Presentationlasinducharith
 
Grammar book #2
Grammar book #2Grammar book #2
Grammar book #2es10190
 
Grammar book semester 2
Grammar book semester 2Grammar book semester 2
Grammar book semester 2Zach Sanchez
 
Collective bargaining india
Collective bargaining indiaCollective bargaining india
Collective bargaining indiasulejen
 

Andere mochten auch (14)

Grammarhandbook
GrammarhandbookGrammarhandbook
Grammarhandbook
 
Weave-D - 2nd Progress Evaluation Presentation
Weave-D - 2nd Progress Evaluation PresentationWeave-D - 2nd Progress Evaluation Presentation
Weave-D - 2nd Progress Evaluation Presentation
 
Grammarhandbook semester 2 sp3h
Grammarhandbook semester 2 sp3hGrammarhandbook semester 2 sp3h
Grammarhandbook semester 2 sp3h
 
El día de los muertos document
El día de los muertos documentEl día de los muertos document
El día de los muertos document
 
台東中小企業課講座
台東中小企業課講座台東中小企業課講座
台東中小企業課講座
 
Actividad 2 (permanente)
Actividad 2 (permanente)Actividad 2 (permanente)
Actividad 2 (permanente)
 
NBQSA 2nd round Presentation
NBQSA 2nd round PresentationNBQSA 2nd round Presentation
NBQSA 2nd round Presentation
 
Grammar handbook
Grammar handbookGrammar handbook
Grammar handbook
 
Grammar book #2
Grammar book #2Grammar book #2
Grammar book #2
 
Grammar handbook
Grammar handbookGrammar handbook
Grammar handbook
 
Grammar book semester 2
Grammar book semester 2Grammar book semester 2
Grammar book semester 2
 
Eye tester
Eye testerEye tester
Eye tester
 
Grammar handbook
Grammar handbookGrammar handbook
Grammar handbook
 
Collective bargaining india
Collective bargaining indiaCollective bargaining india
Collective bargaining india
 

Ähnlich wie Internship Project (Lasindu) WSO2

CMP301_Deep Dive on Amazon EC2 Instances
CMP301_Deep Dive on Amazon EC2 InstancesCMP301_Deep Dive on Amazon EC2 Instances
CMP301_Deep Dive on Amazon EC2 InstancesAmazon Web Services
 
kubernetes를 부탁해~ Prometheus 기반 Monitoring 구축&활용기
kubernetes를 부탁해~ Prometheus 기반 Monitoring 구축&활용기kubernetes를 부탁해~ Prometheus 기반 Monitoring 구축&활용기
kubernetes를 부탁해~ Prometheus 기반 Monitoring 구축&활용기Jinsu Moon
 
[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with Prometheus
[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with Prometheus[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with Prometheus
[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with PrometheusOpenStack Korea Community
 
DevoxxUK: Optimizating Application Performance on Kubernetes
DevoxxUK: Optimizating Application Performance on KubernetesDevoxxUK: Optimizating Application Performance on Kubernetes
DevoxxUK: Optimizating Application Performance on KubernetesDinakar Guniguntala
 
Know More About Rational Performance - Snehamoy K
Know More About Rational Performance - Snehamoy KKnow More About Rational Performance - Snehamoy K
Know More About Rational Performance - Snehamoy KRoopa Nadkarni
 
3 know more_about_rational_performance_tester_8-1-snehamoy_k
3 know more_about_rational_performance_tester_8-1-snehamoy_k3 know more_about_rational_performance_tester_8-1-snehamoy_k
3 know more_about_rational_performance_tester_8-1-snehamoy_kIBM
 
Building Asynchronous Services With Sca
Building Asynchronous Services With ScaBuilding Asynchronous Services With Sca
Building Asynchronous Services With ScaLuciano Resende
 
CPN302 your-linux-ami-optimization-and-performance
CPN302 your-linux-ami-optimization-and-performanceCPN302 your-linux-ami-optimization-and-performance
CPN302 your-linux-ami-optimization-and-performanceCoburn Watson
 
Performance eng prakash.sahu
Performance eng prakash.sahuPerformance eng prakash.sahu
Performance eng prakash.sahuDr. Prakash Sahu
 
Scalable Services For Digital Preservation Ross King
Scalable Services For Digital Preservation Ross KingScalable Services For Digital Preservation Ross King
Scalable Services For Digital Preservation Ross KingDigitalPreservationEurope
 
ROLE OF DIGITAL SIMULATION IN CONFIGURING NETWORK PARAMETERS
ROLE OF DIGITAL SIMULATION IN CONFIGURING NETWORK PARAMETERSROLE OF DIGITAL SIMULATION IN CONFIGURING NETWORK PARAMETERS
ROLE OF DIGITAL SIMULATION IN CONFIGURING NETWORK PARAMETERSDeepak Shankar
 
Your Linux AMI: Optimization and Performance (CPN302) | AWS re:Invent 2013
Your Linux AMI: Optimization and Performance (CPN302) | AWS re:Invent 2013Your Linux AMI: Optimization and Performance (CPN302) | AWS re:Invent 2013
Your Linux AMI: Optimization and Performance (CPN302) | AWS re:Invent 2013Amazon Web Services
 
Windows Azure Interoperability
Windows Azure InteroperabilityWindows Azure Interoperability
Windows Azure InteroperabilityMihai Dan Nadas
 
Building Continuous Application with Structured Streaming and Real-Time Data ...
Building Continuous Application with Structured Streaming and Real-Time Data ...Building Continuous Application with Structured Streaming and Real-Time Data ...
Building Continuous Application with Structured Streaming and Real-Time Data ...Databricks
 
What is new in WCF 4.0?
What is new in WCF 4.0?What is new in WCF 4.0?
What is new in WCF 4.0?Bala Subra
 
The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...
The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...
The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...netvis
 
weblogic perfomence tuning
weblogic perfomence tuningweblogic perfomence tuning
weblogic perfomence tuningprathap kumar
 
Common Sense Performance Indicators in the Cloud
Common Sense Performance Indicators in the CloudCommon Sense Performance Indicators in the Cloud
Common Sense Performance Indicators in the CloudNick Gerner
 
NServiceBus_for_Admins
NServiceBus_for_AdminsNServiceBus_for_Admins
NServiceBus_for_AdminsAdam Fyles
 
Hpe service virtualization 3.8 what's new chicago adm
Hpe service virtualization 3.8 what's new chicago admHpe service virtualization 3.8 what's new chicago adm
Hpe service virtualization 3.8 what's new chicago admJeffrey Nunn
 

Ähnlich wie Internship Project (Lasindu) WSO2 (20)

CMP301_Deep Dive on Amazon EC2 Instances
CMP301_Deep Dive on Amazon EC2 InstancesCMP301_Deep Dive on Amazon EC2 Instances
CMP301_Deep Dive on Amazon EC2 Instances
 
kubernetes를 부탁해~ Prometheus 기반 Monitoring 구축&활용기
kubernetes를 부탁해~ Prometheus 기반 Monitoring 구축&활용기kubernetes를 부탁해~ Prometheus 기반 Monitoring 구축&활용기
kubernetes를 부탁해~ Prometheus 기반 Monitoring 구축&활용기
 
[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with Prometheus
[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with Prometheus[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with Prometheus
[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with Prometheus
 
DevoxxUK: Optimizating Application Performance on Kubernetes
DevoxxUK: Optimizating Application Performance on KubernetesDevoxxUK: Optimizating Application Performance on Kubernetes
DevoxxUK: Optimizating Application Performance on Kubernetes
 
Know More About Rational Performance - Snehamoy K
Know More About Rational Performance - Snehamoy KKnow More About Rational Performance - Snehamoy K
Know More About Rational Performance - Snehamoy K
 
3 know more_about_rational_performance_tester_8-1-snehamoy_k
3 know more_about_rational_performance_tester_8-1-snehamoy_k3 know more_about_rational_performance_tester_8-1-snehamoy_k
3 know more_about_rational_performance_tester_8-1-snehamoy_k
 
Building Asynchronous Services With Sca
Building Asynchronous Services With ScaBuilding Asynchronous Services With Sca
Building Asynchronous Services With Sca
 
CPN302 your-linux-ami-optimization-and-performance
CPN302 your-linux-ami-optimization-and-performanceCPN302 your-linux-ami-optimization-and-performance
CPN302 your-linux-ami-optimization-and-performance
 
Performance eng prakash.sahu
Performance eng prakash.sahuPerformance eng prakash.sahu
Performance eng prakash.sahu
 
Scalable Services For Digital Preservation Ross King
Scalable Services For Digital Preservation Ross KingScalable Services For Digital Preservation Ross King
Scalable Services For Digital Preservation Ross King
 
ROLE OF DIGITAL SIMULATION IN CONFIGURING NETWORK PARAMETERS
ROLE OF DIGITAL SIMULATION IN CONFIGURING NETWORK PARAMETERSROLE OF DIGITAL SIMULATION IN CONFIGURING NETWORK PARAMETERS
ROLE OF DIGITAL SIMULATION IN CONFIGURING NETWORK PARAMETERS
 
Your Linux AMI: Optimization and Performance (CPN302) | AWS re:Invent 2013
Your Linux AMI: Optimization and Performance (CPN302) | AWS re:Invent 2013Your Linux AMI: Optimization and Performance (CPN302) | AWS re:Invent 2013
Your Linux AMI: Optimization and Performance (CPN302) | AWS re:Invent 2013
 
Windows Azure Interoperability
Windows Azure InteroperabilityWindows Azure Interoperability
Windows Azure Interoperability
 
Building Continuous Application with Structured Streaming and Real-Time Data ...
Building Continuous Application with Structured Streaming and Real-Time Data ...Building Continuous Application with Structured Streaming and Real-Time Data ...
Building Continuous Application with Structured Streaming and Real-Time Data ...
 
What is new in WCF 4.0?
What is new in WCF 4.0?What is new in WCF 4.0?
What is new in WCF 4.0?
 
The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...
The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...
The sFlow Standard: Scalable, Unified Monitoring of Networks, Systems and App...
 
weblogic perfomence tuning
weblogic perfomence tuningweblogic perfomence tuning
weblogic perfomence tuning
 
Common Sense Performance Indicators in the Cloud
Common Sense Performance Indicators in the CloudCommon Sense Performance Indicators in the Cloud
Common Sense Performance Indicators in the Cloud
 
NServiceBus_for_Admins
NServiceBus_for_AdminsNServiceBus_for_Admins
NServiceBus_for_Admins
 
Hpe service virtualization 3.8 what's new chicago adm
Hpe service virtualization 3.8 what's new chicago admHpe service virtualization 3.8 what's new chicago adm
Hpe service virtualization 3.8 what's new chicago adm
 

Kürzlich hochgeladen

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Kürzlich hochgeladen (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

Internship Project (Lasindu) WSO2

  • 1.
  • 2. WSO2 Stratos - Tenent CPU usage metering Lasindu Charith Vidana Pathiranage University of Moratuwa
  • 3. Outline 1. Requirements 2. Implementation 3. Demo 4. Problems 5. Things Learnt 6. Q & A
  • 4. Current implementation for tenant usage metering and billing in Stratos ✔ Number of users ✔ Disk Storage ✔ Bandwidth usage ✗ CPU Usage ???
  • 5. What are the available CPU usage metering methods ? ● Per Hour ● Per Instance Fixed Rate ● Per User ● Per Tenant Request ??
  • 6. Outline 1. Requirements 2. Implementation 3. Demo 4. Problems 5. Things Learnt 6. Q & A
  • 7. Java ThreadMXBean to rescue.. ● The management interface for the thread system of the JVM. ● Java virtual machine implementation supports measuring the CPU time for the current thread or for any thread. ● getCurrentThreadCpuTime() Returns the total CPU time for the current thread in nanoseconds. ● Does not account for thread sleep/idle time.
  • 8. Sample Code Usage if (Metering is enabled) { //check the system property (carbon.xml) if(tenant!= carbon.super && context equals “services” or “webapps”) { startCpuTime=threadMXBean.getCurrentThreadCpuTime() //get thread cpu time } } //Executable code if (Metering is enabled) { if(tenant!= carbon.super && context equals “services” or “webapps”) { endCpuTime = Get thread Cpu time threadCpuTime = (endCpuTime – startCpuTime)/1000000 //to milliseconds if(threadCpuTime> 0) Add cpuStatisticsEntry to Queue } }
  • 9. CPU time of requests passing through Tomcat to ODE Thread Pool Request Request BPEL Response Axis 2 Component Tomcat Valves Invoke Tomcat Servlet Transport (Job) Apache ODE Internal Thread Pool Scheduler Simple
  • 10. ESB CPU Time … Synapse Proxy Service In Sequence Class Endpoint Mediator Service Consumer ServerWorker Provider Out Sequence Class Mediator ClientWorker
  • 11. How it works ?? Thread Execution Component CpuUsageStatisticsContainer CpuUsageStatistics Retreive retrieval Component CpuUsageStatisticsEntries Queue Thread CPU Time per Request Send Existing (To be used for Billing Publish Stratos Usage Agent and Throttling) Component
  • 12. Usage Agent -> BAM Publish Usage Agent Component Usage < tenantID, measurement, value > Bandwidth Database CPU Usage Usage Usage
  • 14. BpsCpuUsageStatisticsContainer Data Retriever <CpuUsageStatisticsEntry> BPS Usage Agent Component <<send>> SimpleScheduler PublisherUtils ode Data Persister <<send>> Data Retriever EsbCpuUsageStatisticsContainer <CpuUsageStatisticsEntry> Data Retriever ESB Usage Agent Component ServerWorker ClientWorker Stratos Usage Agent synapse-nhttp- tranport <<retrieve>> CpuUsageStatisticsContainer New Agent Component <CpuUsageStatisticsEntry> TransportStatisticsContainer <CpuUsageStatisticsEntry> ThreadMXBean CarbonStuckThreadDetection Valve Extensible Cpu Time Capturing Component Tomcat Ext
  • 15. Why different … ?? ✔ Every Request does not go through Tomcat servlet transport (eg: ESB uses nhttp requests) ✔ Some products uses their internal thread pools and thread execution mechanisms. (eg : BPS uses Apache Ode & ESB uses Apache Synapse) ✔ BAM script execution is handled by a separate JVM
  • 16. Solution ✔ Specifically capture the CPU time for the products which has above constraints. ✔ Separate Component to retrieve product specific CPU Usage Statistics and send them to Stratos Usage Agent Component. ✔ Should add CPU Statistics to the same Usage Agent instance, once it is registered as an OSGI Service.
  • 17. How to use tenant CPU usage Statistics  Metered CPU Statistics will be summarized in BAM.  Data will be used for billing and throttling.  Tenants will be throttled and billed at the end of the month according to their CPU usage. Summarized Data in BAM using a Hive Script
  • 18. How they all fit - in …??? er Throttling st to Serv Reque Agent Client Metering Data Store Mediator Agent ( Optional ) Server Usage Agent
  • 19. Outline 1. Requirements 2. Implementation 3. Demo 4. Problems 5. Things Learnt 6. Q & A
  • 20. Demo ✔ CPU time for a ✔ Remotely debug for correctness • Sample Web-service ✔ Summarize data at BAM • BPEL Process side • ESB Proxy Service
  • 21. Outline 1. Requirements 2. Implementation 3. Demo 4. Problems 5. Things Learnt 6. Q & A
  • 22. Problems [1] Products are different  Thread handling is done differently in some products. Had to remotely debug each an every product's dependent apache code (ode/synapse/hive/hadoop) and find the thread execution part and capture the CPU time of each request  Usually tenant information is not associated with each request/response in apache code. I had to send the tenant domain/id in certain cases as a parameter in the invoke method from the particular component or set it as a property so that I could find which request comes from which tenant.
  • 23. Problems Continued .. [2] Retrieving data from different dependencies  Cannot add direct dependencies to ode/synapse in Stratos usage agent component since it is not used in every WSO2 product. I had to write new component to do the data retrieval/persistence tasks for each product, where I had to capture CPU time, except for Tomcat.ext  Had to register UsageDataPersistenceManager in usage agent as an OSGI service, so that ESB/BPS components can add the CPU usage data to the same instance that is used by the org.wso2.carbon.usage.agent component's persistence queue.
  • 24. Problems Continued .. [3] Accurate CPU Usage data ..??  Request execution live time and CPU time are very close values, but CPU time is less than the live time.  Thread sleep time is not captured as CPU time.  Thread CPU time is aggregated in ThreadMXBean. Had to take the difference of thread CPU time always for a particular request.
  • 25. Problems Continued .. [4] Performance Hit ...??  EnableMetring is set to 'false' by default in carbon.xml. CPU time measuring code is executed only if metering is enabled.  Tested for Tomcat.ext after metering is enabled. No noticeable change in SOAPUI for a of web service call burst.  Tested for several types of ESB proxy services with and without code from Apache Jmeter and there is no sign of change in TPS.
  • 26. Performance Comparison with Apache Jmeter ESB Echo Proxy Service – 1000 Samples No of Threads : 100 Ramp-up period : 5s Loop Count : 10 Average Median 90% Line Min Max Error Throughput 3 3 6 2 26 0.0% 199.7/sec 3 3 6 2 18 0.0% 199.4/sec Without Code 3 2 6 2 34 0.0% 199.6/sec 2 2 6 2 32 0.0% 199.3/sec 3 2 6 2 22 0.0% 199.7/sec Average Median 90% Line Min Max Error Throughput 4 3 7 2 38 0.0% 199.1/sec With Code 3 3 6 2 21 0.0% 199.3/sec 3 3 6 2 38 0.0% 199.6/sec 3 3 6 2 21 0.0% 199.5/sec 2 3 6 2 25 0.0% 199.0/sec
  • 27. Performance Comparison with Apache Jmeter ESB Echo Proxy Service – 1000 Samples No of Threads : 50 Ramp-up period : 5s Loop Count : 20 Average Median 90% Line Min Max Error Throughput 3 3 4 2 19 0.0% 199.0/sec 3 3 4 2 13 0.0% 198.8/sec Without Code 3 3 4 2 21 0.0% 197.5/sec 2 3 4 2 12 0.0% 199.0/sec 2 3 3 2 19 0.0% 199.3/sec Average Median 90% Line Min Max Error Throughput 4 3 7 2 29 0.0% 196.9/sec With Code 4 3 7 2 22 0.0% 199.3/sec 4 3 7 2 21 0.0% 199.5/sec 3 3 6 2 22 0.0% 198.1/sec 2 3 3 2 17 0.0% 199.2/sec
  • 28. Performance Comparison with Apache Jmeter ESB Proxy Service (Class mediator) – 1000 Samples No of Threads : 100 Ramp-up period : 1s Loop Count : 10 Without With Code Code 760.5/sec 766.8/sec 762.2/sec 749.1/sec 754.1/sec 746.8/sec 745.2/sec 746.3/sec 751.9/sec 751.3/sec 763.4/sec 748.5/sec 764.5/sec 757.6/sec 753.6/sec 749.6/sec – Checked out for several types of Proxy services at the same time and total throughput seems to be quite even.
  • 29. Problems Continued .. [5] Product/version problems  Different Products used different versions of the same component  While project goes on several changes to dependent components occurred
  • 30. Outline 1. Requirements 2. Implementation 3. Demo 4. Problems 5. Things Learnt 6. Q & A
  • 31. Automation Hackathon  With GREG team for almost 2 months.  Wrote a lot of test cases and ported old tests to Clarity framework.  Learnt on Greg LCs, Rxts, APIs, URIs, Handlers, Permissions etc.  Learnt to writie axis2 clients to test CRUD Operation support and Discovery Proxy for GREG.  Automated several Support Patches.
  • 33. Above them all ...  Obviously learnt a load of technical things.  How to take important architectural decisions and flexibility of carbon architecture.  How to Communicate ideas with others and get the necessary help.  Was able to get the help of lot of people and work in several products Carbon, AS, ESB, BPS, GREG, BAM, DSS, Stratos etc.  Learnt best practices in software engineering and coding conventions.
  • 34. Above them all ...  How to test software, automate the functionality and how QA functions.  How to use mailing lists effectively.  How to manage time and meet deadlines.  How does a company function and how a company prepares for a release.  Got to know a bunch of good friends/people.  Enjoyed every minute of it.
  • 35. Outline 1. Requirements 2. Implementation 3. Demo 4. Problems 5. Things Learnt 6. Q & A
  • 37. References  http://maharachchi.blogspot.com/2011/08/metering- throttling-and-billing-in.html  http://sanjeewamalalgoda.blogspot.com/2011/08/wso2- stratos-usage-and-throttling_22.html  http://wso2.org/library/articles/2011/11/usage-metering- cloud-environment-using-wso2-stratos  http://docs.oracle.com/javase/6/docs/api/java/lang/manage ment/ThreadMXBean.html  http://jmeter.apache.org