Debugging Grails Database     Performance
Tom Dunstan / @tomdcc                                           tom@energizedwork.com                                     ...
✪ GORM•   One of the best parts of Grails•   Easy data access•   No DAOs etc required•   Can access data from anywhere
✪ GORM•   Can access data from anywhere•   This can be dangerous•   Many data access patterns can coexist•   Difficult to ...
✪ GORM• Getting data out of collections can have  unintended consequences
✪ WHERE CAN WE ACCESS DATA?•   Filters•   URL Mapping Constraints•   Controllers•   Services•   Modules•   Named Queries• ...
✪ WHERE CAN WE ACCESS DATA?• It may not be apparent exactly when  data is being fetched
✪ SPAGHETTI• Long lived projects can evolve  multiple ways of doing things
DEMO 1
✪ SORTING IT OUT• Logging SQL doesn’t tie generated SQL to  specific parts of the codebase
✪ SORTING IT OUT• Existing profiler plugin can automatically log  controller, service and view entry / exits• Not bad, but...
✪ THE TARGET• MVC Mini Profiler• Developed for Stack Overflow• Keeps performance on your mind
✪ THE TARGET
DEMO 2
✪ CURRENT STATUS•   Version 0.1•   Just pushed to Github•   Plugin waiting for approval •   Not all features of MVC Mini ...
✪ FUTURE• Implement missing MVC Mini Profiler features   – SQL Storage   – Detect Duplicate SQL queries
✪ FUTURE• Grails profiler plugin needs some work for 2.0+• Not tested on 2.0+
✪ FUTURE• Split out separate Java library to share  functionality with other frameworks• Show nested GSP names• Show Tag L...
✪ QUESTIONS        https://github.com/tomdcc/grails-miniprofiler                                             Tom Dunstan /...
Upcoming SlideShare
Loading in …5
×

Debugging Grails Database Performance

784 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
784
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Debugging Grails Database Performance

  1. 1. Debugging Grails Database Performance
  2. 2. Tom Dunstan / @tomdcc tom@energizedwork.com #ggxLICENSEDUNDERCREATIVECOMMONSBYENERGIZEDWORKLIMITED |HMSPRESIDENT,VICTORIAEMBANKMENT,LONDON,EC40HJ|WWW.ENERGIZEDWORK.COM 2
  3. 3. ✪ GORM• One of the best parts of Grails• Easy data access• No DAOs etc required• Can access data from anywhere
  4. 4. ✪ GORM• Can access data from anywhere• This can be dangerous• Many data access patterns can coexist• Difficult to work out what is generating a particular query
  5. 5. ✪ GORM• Getting data out of collections can have unintended consequences
  6. 6. ✪ WHERE CAN WE ACCESS DATA?• Filters• URL Mapping Constraints• Controllers• Services• Modules• Named Queries• Helper classes• Views• Tag Libraries
  7. 7. ✪ WHERE CAN WE ACCESS DATA?• It may not be apparent exactly when data is being fetched
  8. 8. ✪ SPAGHETTI• Long lived projects can evolve multiple ways of doing things
  9. 9. DEMO 1
  10. 10. ✪ SORTING IT OUT• Logging SQL doesn’t tie generated SQL to specific parts of the codebase
  11. 11. ✪ SORTING IT OUT• Existing profiler plugin can automatically log controller, service and view entry / exits• Not bad, but doesn’t tie SQL queries to those places• Stuff in e.g. taglibs isn’t made explicit• Stuff in layout vs main view isn’t made explicit
  12. 12. ✪ THE TARGET• MVC Mini Profiler• Developed for Stack Overflow• Keeps performance on your mind
  13. 13. ✪ THE TARGET
  14. 14. DEMO 2
  15. 15. ✪ CURRENT STATUS• Version 0.1• Just pushed to Github• Plugin waiting for approval • Not all features of MVC Mini Profiler
  16. 16. ✪ FUTURE• Implement missing MVC Mini Profiler features – SQL Storage – Detect Duplicate SQL queries
  17. 17. ✪ FUTURE• Grails profiler plugin needs some work for 2.0+• Not tested on 2.0+
  18. 18. ✪ FUTURE• Split out separate Java library to share functionality with other frameworks• Show nested GSP names• Show Tag Library calls• EXPLAIN functionality built in – Debug query performance from within app – Supported by PostgreSQL, MySQL, others?• Support non-SQL data stores
  19. 19. ✪ QUESTIONS https://github.com/tomdcc/grails-miniprofiler Tom Dunstan / @tomdcc tom@energizedwork.com LICENSEDUNDERCREATIVECOMMONSBYENERGIZEDWORKLIMITED |HMSPRESIDENT,VICTORIAEMBANKMENT,LONDON,EC40HJ|WWW.ENERGIZEDWORK.COM 19

×