SlideShare una empresa de Scribd logo
1 de 38
Descargar para leer sin conexión
Runtime compilation and
code execution in groovy
© 2020 EPAM Systems, Inc.
S o f t w a r e E n g i n e e r a t E P A M
R a m a n M a s k a l e n k a
© 2020 EPAM Systems, Inc.
Disclaimer
© 2020 EPAM Systems, Inc.
Problem statement
© 2020 EPAM Systems, Inc.
Problem statement
© 2020 EPAM Systems, Inc.
When can we use it
A S A P R OX Y S E R V I C E W I T H T R A N S F O R M E R
© 2020 EPAM Systems, Inc.
When can we use it
A S A C O M P L E X DY N A M I C A L LY C A LC U L AT E D C O N F I G U R AT I O N
© 2020 EPAM Systems, Inc.
How can we solve it?
© 2020 EPAM Systems, Inc.
AWS Step Function
© 2020 EPAM Systems, Inc.
AWS Step Function
Pros
• AWS is popular
• Different languages support
• Version control
• Source editor
• Lambdas be integrated with Amazon
Xray for tracing
Cons
• Lambdas can be costly if we have a
lot of scripts and high request load
• Appeared only in 2018
© 2020 EPAM Systems, Inc.
How can we solve it?
JSR 199 (mvn-classloadr, jianimo)
Write your own compiler
JSR 223
Oracle Nashorn engine (Till Java 11)
JSR 223
ScriptEngineManager().getEngineByExt
ension("kts")
© 2020 EPAM Systems, Inc.
How can we solve it?
GroovyClassLoader
© 2020 EPAM Systems, Inc.
How does it work?
H I G H L E V E L F LO W
© 2020 EPAM Systems, Inc.
How does it work?
S I M P L EST C O D E E X A M P L E
© 2020 EPAM Systems, Inc.
How does it work?
S I M P L EST C O D E E X A M P L E
© 2020 EPAM Systems, Inc.
How does it work?
DY N A M I C S C R I P T P R O P E R T I ES
• Script state clears between runs (For example script “def v; v = v ? v+1 : 1” will
return the same result during multiple executions)
• Binding variables are mutable and can be used to store/pass state (For example if
we have binding variable “v” and script “v = v+1” binding will be changed during
execution)
• Binding doesn’t create a copy of the passed map so it will be changed aswell
• Script code behaves the same as any other groovy code – you can use “import”
statements in it
• GroovyClassLoader will use your current thread class loader as parent by default,
but you can provide desired parent on your own
© 2020 EPAM Systems, Inc.
Errors and stack trace
D E FAU LT
© 2020 EPAM Systems, Inc.
Errors and stack trace
SA N I T I Z E D A P P R O AC H
© 2020 EPAM Systems, Inc.
Servlet example
© 2020 EPAM Systems, Inc.
© 2020 EPAM Systems, Inc.
Constant class loading?
Jmeter: 50 requests per second, 300 seconds
CATALINA_OPTS=-XX:MaxMetaspaceSize=100m
© 2020 EPAM Systems, Inc.
© 2020 EPAM Systems, Inc.
Constant class loading issue
23
© 2020 EPAM Systems, Inc.
Constant class loading issue
© 2020 EPAM Systems, Inc.
© 2020 EPAM Systems, Inc.
Performance
26
Software
• Jmeter script
• 50 requests per second
• Spf4j to record execution
• Win 10 x64
• Java 8 (1.8.0_151)
• Tomcat 8.5.24
Hardware
• Intel core i5-8600k
• 16 Gb OZU
© 2020 EPAM Systems, Inc.
Performance Jmeter request
27
© 2020 EPAM Systems, Inc.
Performance step 1 parse class max
28
© 2020 EPAM Systems, Inc.
Performance step 1 parse class avg min
29
© 2020 EPAM Systems, Inc.
Performance step 2 create script
30
© 2020 EPAM Systems, Inc.
Performance step 3 run script max
31
© 2020 EPAM Systems, Inc.
Performance step 3 run script avg-min
32
© 2020 EPAM Systems, Inc.
Performance cleanup classes max
33
© 2020 EPAM Systems, Inc.
Performance cleanup classes avg-min
34
© 2020 EPAM Systems, Inc.
Performance jmeter endpoint summary
35
Label # Samples
Avera
ge
Media
n
90%
Line
95%
Line
99%
Line Min Max Error %
Throughp
ut
Receiv
ed
KB/se
c
Sent
KB/se
c
RandomScript 29955 28 17 36 45 99 10 30790,000% 49.92/s8,40 81,86
© 2020 EPAM Systems, Inc.
Pros and cons
Pros
• Reconfiguration on flight
• Works great as transaction
transformer
• Interactive development in runtime
• Almost zero time for deployment
Cons
• Reinventing Source control
• Hard to review
• High Security risks
• Self implemented testing
• Harder to monitor
• High risks of get fired in case of
production error caused by your
change
• More often Major GC
36
© 2020 EPAM Systems, Inc.
CONFIDENTIAL | © 2019 EPAM Systems, Inc.

Más contenido relacionado

Similar a Runtime compilation and code execution in groovy

RMiller.FromMaxL.presentation
RMiller.FromMaxL.presentationRMiller.FromMaxL.presentation
RMiller.FromMaxL.presentationRandy Miller
 
MuleSoft Sizing Guidelines - VirtualMuleys
MuleSoft Sizing Guidelines - VirtualMuleysMuleSoft Sizing Guidelines - VirtualMuleys
MuleSoft Sizing Guidelines - VirtualMuleysAngel Alberici
 
Jump-start your application migration to AWS with CloudEndure - STG305 - New ...
Jump-start your application migration to AWS with CloudEndure - STG305 - New ...Jump-start your application migration to AWS with CloudEndure - STG305 - New ...
Jump-start your application migration to AWS with CloudEndure - STG305 - New ...Amazon Web Services
 
Castles in the Cloud: Developing with Google App Engine
Castles in the Cloud: Developing with Google App EngineCastles in the Cloud: Developing with Google App Engine
Castles in the Cloud: Developing with Google App Enginecatherinewall
 
Can they really do that: CloudFormation, SAM and CDK tips'n'tricks
Can they really do that: CloudFormation, SAM and CDK tips'n'tricksCan they really do that: CloudFormation, SAM and CDK tips'n'tricks
Can they really do that: CloudFormation, SAM and CDK tips'n'tricks🌥 Karen Tovmasyan
 
How to Determine if You Are Well-Architected for Reliability
How to Determine if You Are Well-Architected for ReliabilityHow to Determine if You Are Well-Architected for Reliability
How to Determine if You Are Well-Architected for ReliabilityAmazon Web Services
 
AWS Startup Day Kyiv: Container services on AWS. Comparing Amazon ECS, AWS Fa...
AWS Startup Day Kyiv: Container services on AWS. Comparing Amazon ECS, AWS Fa...AWS Startup Day Kyiv: Container services on AWS. Comparing Amazon ECS, AWS Fa...
AWS Startup Day Kyiv: Container services on AWS. Comparing Amazon ECS, AWS Fa...Amazon Web Services
 
Deep Dive into AWS Fargate - CON333 - re:Invent 2017
Deep Dive into AWS Fargate - CON333 - re:Invent 2017Deep Dive into AWS Fargate - CON333 - re:Invent 2017
Deep Dive into AWS Fargate - CON333 - re:Invent 2017Amazon Web Services
 
JNUC 2017: Open Distribution Server
JNUC 2017: Open Distribution ServerJNUC 2017: Open Distribution Server
JNUC 2017: Open Distribution ServerBryson Tyrrell
 
EMC World 2016 - mioaITL.08 Infrastructure as Code: Not Your Parent's Data Ce...
EMC World 2016 - mioaITL.08 Infrastructure as Code: Not Your Parent's Data Ce...EMC World 2016 - mioaITL.08 Infrastructure as Code: Not Your Parent's Data Ce...
EMC World 2016 - mioaITL.08 Infrastructure as Code: Not Your Parent's Data Ce...{code}
 
Rodney Lester: Well-Architected - Reliability Instructor Led Lab.pdf
Rodney Lester: Well-Architected - Reliability Instructor Led Lab.pdfRodney Lester: Well-Architected - Reliability Instructor Led Lab.pdf
Rodney Lester: Well-Architected - Reliability Instructor Led Lab.pdfAmazon Web Services
 
Salt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsSalt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsBenjamin Cane
 
FDM to FDMEE migration utility
FDM to FDMEE migration utilityFDM to FDMEE migration utility
FDM to FDMEE migration utilityBernard Ash
 
Advanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step FunctionsAdvanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step FunctionsAmazon Web Services
 
QCon Shanghai: Trends in Application Development
QCon Shanghai: Trends in Application DevelopmentQCon Shanghai: Trends in Application Development
QCon Shanghai: Trends in Application DevelopmentChris Bailey
 
GAM307_Ubisoft How For Honor Runs Using Amazon ECS
GAM307_Ubisoft How For Honor Runs Using Amazon ECSGAM307_Ubisoft How For Honor Runs Using Amazon ECS
GAM307_Ubisoft How For Honor Runs Using Amazon ECSAmazon Web Services
 
Remove Undifferentiated Heavy Lifting from Jenkins (DEV201-R1) - AWS re:Inven...
Remove Undifferentiated Heavy Lifting from Jenkins (DEV201-R1) - AWS re:Inven...Remove Undifferentiated Heavy Lifting from Jenkins (DEV201-R1) - AWS re:Inven...
Remove Undifferentiated Heavy Lifting from Jenkins (DEV201-R1) - AWS re:Inven...Amazon Web Services
 
Advanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step FunctionsAdvanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step FunctionsAmazon Web Services
 
WebAssembly & Zero Trust for Code
WebAssembly & Zero Trust for CodeWebAssembly & Zero Trust for Code
WebAssembly & Zero Trust for CodeAll Things Open
 

Similar a Runtime compilation and code execution in groovy (20)

RMiller.FromMaxL.presentation
RMiller.FromMaxL.presentationRMiller.FromMaxL.presentation
RMiller.FromMaxL.presentation
 
MuleSoft Sizing Guidelines - VirtualMuleys
MuleSoft Sizing Guidelines - VirtualMuleysMuleSoft Sizing Guidelines - VirtualMuleys
MuleSoft Sizing Guidelines - VirtualMuleys
 
Jump-start your application migration to AWS with CloudEndure - STG305 - New ...
Jump-start your application migration to AWS with CloudEndure - STG305 - New ...Jump-start your application migration to AWS with CloudEndure - STG305 - New ...
Jump-start your application migration to AWS with CloudEndure - STG305 - New ...
 
Castles in the Cloud: Developing with Google App Engine
Castles in the Cloud: Developing with Google App EngineCastles in the Cloud: Developing with Google App Engine
Castles in the Cloud: Developing with Google App Engine
 
Can they really do that: CloudFormation, SAM and CDK tips'n'tricks
Can they really do that: CloudFormation, SAM and CDK tips'n'tricksCan they really do that: CloudFormation, SAM and CDK tips'n'tricks
Can they really do that: CloudFormation, SAM and CDK tips'n'tricks
 
How to Determine if You Are Well-Architected for Reliability
How to Determine if You Are Well-Architected for ReliabilityHow to Determine if You Are Well-Architected for Reliability
How to Determine if You Are Well-Architected for Reliability
 
AWS Startup Day Kyiv: Container services on AWS. Comparing Amazon ECS, AWS Fa...
AWS Startup Day Kyiv: Container services on AWS. Comparing Amazon ECS, AWS Fa...AWS Startup Day Kyiv: Container services on AWS. Comparing Amazon ECS, AWS Fa...
AWS Startup Day Kyiv: Container services on AWS. Comparing Amazon ECS, AWS Fa...
 
AWS Container services
AWS Container servicesAWS Container services
AWS Container services
 
Deep Dive into AWS Fargate - CON333 - re:Invent 2017
Deep Dive into AWS Fargate - CON333 - re:Invent 2017Deep Dive into AWS Fargate - CON333 - re:Invent 2017
Deep Dive into AWS Fargate - CON333 - re:Invent 2017
 
JNUC 2017: Open Distribution Server
JNUC 2017: Open Distribution ServerJNUC 2017: Open Distribution Server
JNUC 2017: Open Distribution Server
 
EMC World 2016 - mioaITL.08 Infrastructure as Code: Not Your Parent's Data Ce...
EMC World 2016 - mioaITL.08 Infrastructure as Code: Not Your Parent's Data Ce...EMC World 2016 - mioaITL.08 Infrastructure as Code: Not Your Parent's Data Ce...
EMC World 2016 - mioaITL.08 Infrastructure as Code: Not Your Parent's Data Ce...
 
Rodney Lester: Well-Architected - Reliability Instructor Led Lab.pdf
Rodney Lester: Well-Architected - Reliability Instructor Led Lab.pdfRodney Lester: Well-Architected - Reliability Instructor Led Lab.pdf
Rodney Lester: Well-Architected - Reliability Instructor Led Lab.pdf
 
Salt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environmentsSalt conf 2014 - Using SaltStack in high availability environments
Salt conf 2014 - Using SaltStack in high availability environments
 
FDM to FDMEE migration utility
FDM to FDMEE migration utilityFDM to FDMEE migration utility
FDM to FDMEE migration utility
 
Advanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step FunctionsAdvanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step Functions
 
QCon Shanghai: Trends in Application Development
QCon Shanghai: Trends in Application DevelopmentQCon Shanghai: Trends in Application Development
QCon Shanghai: Trends in Application Development
 
GAM307_Ubisoft How For Honor Runs Using Amazon ECS
GAM307_Ubisoft How For Honor Runs Using Amazon ECSGAM307_Ubisoft How For Honor Runs Using Amazon ECS
GAM307_Ubisoft How For Honor Runs Using Amazon ECS
 
Remove Undifferentiated Heavy Lifting from Jenkins (DEV201-R1) - AWS re:Inven...
Remove Undifferentiated Heavy Lifting from Jenkins (DEV201-R1) - AWS re:Inven...Remove Undifferentiated Heavy Lifting from Jenkins (DEV201-R1) - AWS re:Inven...
Remove Undifferentiated Heavy Lifting from Jenkins (DEV201-R1) - AWS re:Inven...
 
Advanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step FunctionsAdvanced Serverless Apps With Step Functions
Advanced Serverless Apps With Step Functions
 
WebAssembly & Zero Trust for Code
WebAssembly & Zero Trust for CodeWebAssembly & Zero Trust for Code
WebAssembly & Zero Trust for Code
 

Más de Vitebsk Miniq

The 5 Laws of Software Estimates
The 5 Laws of Software EstimatesThe 5 Laws of Software Estimates
The 5 Laws of Software EstimatesVitebsk Miniq
 
Latest & Greatest Observability Release 7.9
Latest & Greatest Observability Release 7.9Latest & Greatest Observability Release 7.9
Latest & Greatest Observability Release 7.9Vitebsk Miniq
 
Тестирование Spring-based приложений
Тестирование Spring-based приложенийТестирование Spring-based приложений
Тестирование Spring-based приложенийVitebsk Miniq
 
Семантический поиск - что это, как работает и чем отличается от просто поиска
Семантический поиск - что это, как работает и чем отличается от просто поискаСемантический поиск - что это, как работает и чем отличается от просто поиска
Семантический поиск - что это, как работает и чем отличается от просто поискаVitebsk Miniq
 
Локализационное тестирование - это не только перевод
Локализационное тестирование - это не только переводЛокализационное тестирование - это не только перевод
Локализационное тестирование - это не только переводVitebsk Miniq
 
ISTQB Сертификация тестировщиков: быть или не быть?
ISTQB Сертификация тестировщиков: быть или не быть?ISTQB Сертификация тестировщиков: быть или не быть?
ISTQB Сертификация тестировщиков: быть или не быть?Vitebsk Miniq
 
Apollo GraphQL Federation
Apollo GraphQL FederationApollo GraphQL Federation
Apollo GraphQL FederationVitebsk Miniq
 
Who is a functional tester
Who is a functional testerWho is a functional tester
Who is a functional testerVitebsk Miniq
 
Вперед в прошлое
Вперед в прошлоеВперед в прошлое
Вперед в прошлоеVitebsk Miniq
 
CloudFormation experience
CloudFormation experienceCloudFormation experience
CloudFormation experienceVitebsk Miniq
 
Learning Intelligence: the story of mine
Learning Intelligence: the story of mineLearning Intelligence: the story of mine
Learning Intelligence: the story of mineVitebsk Miniq
 
Как программисты могут спасти мир
Как программисты могут спасти мирКак программисты могут спасти мир
Как программисты могут спасти мирVitebsk Miniq
 
Использование AzureDevOps при разработке микросервисных приложений
Использование AzureDevOps при разработке микросервисных приложенийИспользование AzureDevOps при разработке микросервисных приложений
Использование AzureDevOps при разработке микросервисных приложенийVitebsk Miniq
 
Distributed tracing system in action. Instana Tracing.
Distributed tracing system in action. Instana Tracing.Distributed tracing system in action. Instana Tracing.
Distributed tracing system in action. Instana Tracing.Vitebsk Miniq
 
Насорил - убери!
Насорил - убери!Насорил - убери!
Насорил - убери!Vitebsk Miniq
 
Styled-components. Что? Когда? И зачем?
Styled-components. Что? Когда? И зачем?Styled-components. Что? Когда? И зачем?
Styled-components. Что? Когда? И зачем?Vitebsk Miniq
 
Красные флаги и розовые очки
Красные флаги и розовые очкиКрасные флаги и розовые очки
Красные флаги и розовые очкиVitebsk Miniq
 
CSS. Практика
CSS. ПрактикаCSS. Практика
CSS. ПрактикаVitebsk Miniq
 
Разделяй и властвуй!
Разделяй и властвуй!Разделяй и властвуй!
Разделяй и властвуй!Vitebsk Miniq
 

Más de Vitebsk Miniq (20)

The 5 Laws of Software Estimates
The 5 Laws of Software EstimatesThe 5 Laws of Software Estimates
The 5 Laws of Software Estimates
 
Latest & Greatest Observability Release 7.9
Latest & Greatest Observability Release 7.9Latest & Greatest Observability Release 7.9
Latest & Greatest Observability Release 7.9
 
Тестирование Spring-based приложений
Тестирование Spring-based приложенийТестирование Spring-based приложений
Тестирование Spring-based приложений
 
Семантический поиск - что это, как работает и чем отличается от просто поиска
Семантический поиск - что это, как работает и чем отличается от просто поискаСемантический поиск - что это, как работает и чем отличается от просто поиска
Семантический поиск - что это, как работает и чем отличается от просто поиска
 
Локализационное тестирование - это не только перевод
Локализационное тестирование - это не только переводЛокализационное тестирование - это не только перевод
Локализационное тестирование - это не только перевод
 
ISTQB Сертификация тестировщиков: быть или не быть?
ISTQB Сертификация тестировщиков: быть или не быть?ISTQB Сертификация тестировщиков: быть или не быть?
ISTQB Сертификация тестировщиков: быть или не быть?
 
Apollo GraphQL Federation
Apollo GraphQL FederationApollo GraphQL Federation
Apollo GraphQL Federation
 
Who is a functional tester
Who is a functional testerWho is a functional tester
Who is a functional tester
 
Crawling healthy
Crawling healthyCrawling healthy
Crawling healthy
 
Вперед в прошлое
Вперед в прошлоеВперед в прошлое
Вперед в прошлое
 
CloudFormation experience
CloudFormation experienceCloudFormation experience
CloudFormation experience
 
Learning Intelligence: the story of mine
Learning Intelligence: the story of mineLearning Intelligence: the story of mine
Learning Intelligence: the story of mine
 
Как программисты могут спасти мир
Как программисты могут спасти мирКак программисты могут спасти мир
Как программисты могут спасти мир
 
Использование AzureDevOps при разработке микросервисных приложений
Использование AzureDevOps при разработке микросервисных приложенийИспользование AzureDevOps при разработке микросервисных приложений
Использование AzureDevOps при разработке микросервисных приложений
 
Distributed tracing system in action. Instana Tracing.
Distributed tracing system in action. Instana Tracing.Distributed tracing system in action. Instana Tracing.
Distributed tracing system in action. Instana Tracing.
 
Насорил - убери!
Насорил - убери!Насорил - убери!
Насорил - убери!
 
Styled-components. Что? Когда? И зачем?
Styled-components. Что? Когда? И зачем?Styled-components. Что? Когда? И зачем?
Styled-components. Что? Когда? И зачем?
 
Красные флаги и розовые очки
Красные флаги и розовые очкиКрасные флаги и розовые очки
Красные флаги и розовые очки
 
CSS. Практика
CSS. ПрактикаCSS. Практика
CSS. Практика
 
Разделяй и властвуй!
Разделяй и властвуй!Разделяй и властвуй!
Разделяй и властвуй!
 

Último

Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxFIDO Alliance
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxjbellis
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....rightmanforbloodline
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...caitlingebhard1
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform EngineeringMarcus Vechiato
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch TuesdayIvanti
 
Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfOverkill Security
 
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfFrisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfAnubhavMangla3
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentationyogeshlabana357357
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Paige Cruz
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxMarkSteadman7
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxFIDO Alliance
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...panagenda
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfdanishmna97
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxFIDO Alliance
 

Último (20)

Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdf
 
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfFrisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 

Runtime compilation and code execution in groovy

  • 1. Runtime compilation and code execution in groovy
  • 2. © 2020 EPAM Systems, Inc. S o f t w a r e E n g i n e e r a t E P A M R a m a n M a s k a l e n k a
  • 3. © 2020 EPAM Systems, Inc. Disclaimer
  • 4. © 2020 EPAM Systems, Inc. Problem statement
  • 5. © 2020 EPAM Systems, Inc. Problem statement
  • 6. © 2020 EPAM Systems, Inc. When can we use it A S A P R OX Y S E R V I C E W I T H T R A N S F O R M E R
  • 7. © 2020 EPAM Systems, Inc. When can we use it A S A C O M P L E X DY N A M I C A L LY C A LC U L AT E D C O N F I G U R AT I O N
  • 8. © 2020 EPAM Systems, Inc. How can we solve it?
  • 9. © 2020 EPAM Systems, Inc. AWS Step Function
  • 10. © 2020 EPAM Systems, Inc. AWS Step Function Pros • AWS is popular • Different languages support • Version control • Source editor • Lambdas be integrated with Amazon Xray for tracing Cons • Lambdas can be costly if we have a lot of scripts and high request load • Appeared only in 2018
  • 11. © 2020 EPAM Systems, Inc. How can we solve it? JSR 199 (mvn-classloadr, jianimo) Write your own compiler JSR 223 Oracle Nashorn engine (Till Java 11) JSR 223 ScriptEngineManager().getEngineByExt ension("kts")
  • 12. © 2020 EPAM Systems, Inc. How can we solve it? GroovyClassLoader
  • 13. © 2020 EPAM Systems, Inc. How does it work? H I G H L E V E L F LO W
  • 14. © 2020 EPAM Systems, Inc. How does it work? S I M P L EST C O D E E X A M P L E
  • 15. © 2020 EPAM Systems, Inc. How does it work? S I M P L EST C O D E E X A M P L E
  • 16. © 2020 EPAM Systems, Inc. How does it work? DY N A M I C S C R I P T P R O P E R T I ES • Script state clears between runs (For example script “def v; v = v ? v+1 : 1” will return the same result during multiple executions) • Binding variables are mutable and can be used to store/pass state (For example if we have binding variable “v” and script “v = v+1” binding will be changed during execution) • Binding doesn’t create a copy of the passed map so it will be changed aswell • Script code behaves the same as any other groovy code – you can use “import” statements in it • GroovyClassLoader will use your current thread class loader as parent by default, but you can provide desired parent on your own
  • 17. © 2020 EPAM Systems, Inc. Errors and stack trace D E FAU LT
  • 18. © 2020 EPAM Systems, Inc. Errors and stack trace SA N I T I Z E D A P P R O AC H
  • 19. © 2020 EPAM Systems, Inc. Servlet example
  • 20. © 2020 EPAM Systems, Inc.
  • 21. © 2020 EPAM Systems, Inc. Constant class loading? Jmeter: 50 requests per second, 300 seconds CATALINA_OPTS=-XX:MaxMetaspaceSize=100m
  • 22. © 2020 EPAM Systems, Inc.
  • 23. © 2020 EPAM Systems, Inc. Constant class loading issue 23
  • 24. © 2020 EPAM Systems, Inc. Constant class loading issue
  • 25. © 2020 EPAM Systems, Inc.
  • 26. © 2020 EPAM Systems, Inc. Performance 26 Software • Jmeter script • 50 requests per second • Spf4j to record execution • Win 10 x64 • Java 8 (1.8.0_151) • Tomcat 8.5.24 Hardware • Intel core i5-8600k • 16 Gb OZU
  • 27. © 2020 EPAM Systems, Inc. Performance Jmeter request 27
  • 28. © 2020 EPAM Systems, Inc. Performance step 1 parse class max 28
  • 29. © 2020 EPAM Systems, Inc. Performance step 1 parse class avg min 29
  • 30. © 2020 EPAM Systems, Inc. Performance step 2 create script 30
  • 31. © 2020 EPAM Systems, Inc. Performance step 3 run script max 31
  • 32. © 2020 EPAM Systems, Inc. Performance step 3 run script avg-min 32
  • 33. © 2020 EPAM Systems, Inc. Performance cleanup classes max 33
  • 34. © 2020 EPAM Systems, Inc. Performance cleanup classes avg-min 34
  • 35. © 2020 EPAM Systems, Inc. Performance jmeter endpoint summary 35 Label # Samples Avera ge Media n 90% Line 95% Line 99% Line Min Max Error % Throughp ut Receiv ed KB/se c Sent KB/se c RandomScript 29955 28 17 36 45 99 10 30790,000% 49.92/s8,40 81,86
  • 36. © 2020 EPAM Systems, Inc. Pros and cons Pros • Reconfiguration on flight • Works great as transaction transformer • Interactive development in runtime • Almost zero time for deployment Cons • Reinventing Source control • Hard to review • High Security risks • Self implemented testing • Harder to monitor • High risks of get fired in case of production error caused by your change • More often Major GC 36
  • 37. © 2020 EPAM Systems, Inc.
  • 38. CONFIDENTIAL | © 2019 EPAM Systems, Inc.