SlideShare a Scribd company logo
1 of 38
Download to read offline
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.

More Related Content

Similar to 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 to 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
 

More from 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
 

More from 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. Практика
 
Разделяй и властвуй!
Разделяй и властвуй!Разделяй и властвуй!
Разделяй и властвуй!
 

Recently uploaded

Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 

Recently uploaded (20)

Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 

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.