Medium EC2 with RDS having no IOPS
Grails 2.1.1 environment with a number of plugins
Huge DB with transactions trying to insert as many as 100k records
New setup was limited in terms of CPU and memory resources and therefore reveal more glaring mistakes in code with regard to performance considerations
2. About Neev
Web
Mobile
Magento eCommerce
SaaS Applications
Video Streaming Portals
Rich Internet Apps
Custom Development
iPhone
Android
Windows Phone 7
HTML5 Apps
Cloud
AWS Consulting Partner
Rackspace
Joyent
Heroku
Google App Engine
Key Company Highlights
250+ team with experience in
managing
offshore, distributed
development.
Neev Technologies
established in Jan ’05
VC Funding in 2009 By Basil
Partners
User Interface Design and User Experience Design
Part of Publicis Groupe
Member of NASSCOM.
Performance Consulting Practices
Development Centers in
Bangalore and Pune.
Quality Assurance & Testing
Outsourced Product Development
Offices at
Bangalore, USA, Delhi, Pune,
Singapore and Stockholm.
3. The Scenario used for Testing Grails Application Performance
• Medium EC2 with RDS having no IOPS
• Grails 2.1.1 environment with a number of plugins
• Huge DB with transactions trying to insert as many as 100k records
• New setup was limited in terms of CPU and memory resources and therefore
reveal more glaring mistakes in code with regard to performance
considerations
4. What helps to Improve Performance
• Paste the code in console and type ‘Ctrl+R’. No need to navigate through
screens or authentication
• Change domain module to include only a reference of the parents key
instead of the whole object.
• Enable Hibernate’s second level of caching by adding suitable code to
DataSource.groovy and by making changes in the domain class
• Configure ehcache.xml
• Create indexes on parent classes after using explain on MySQL tables. This
improves performance marginally
• Cleaning up Gorm after doing batch inserts also helps
• Refer page for relevant code :
http://www.neevtech.com/blog/2013/02/08/improving-your-grailsapplication-performance-look-jim-no-stored-procedures/
5. The Real Bottleneck and the Solution
• The session cache was very large because Grails has FlushMode set to ‘AUTO’
• It was observed that Grails makes a Session ‘Flush’ before querying - this could be
reducing performance
The remedy is to:
• Import org.hibernate.FlushMode
• Include this line, session.setflushMode (FlushMode.COMMIT)
• Performance improvement after these changes - processes nearly 450k records in 1
hour as opposed to 20k records earlier in 2 hours.
• Refer for relevant code and more info :
http://www.neevtech.com/blog/2013/02/08/improving-your-grails-applicationperformance-look-jim-no-stored-procedures/