Porting Spring PetClinic to GigaSpaces

3,628 views
3,526 views

Published on

This presentation shows the general methodology of porting a JEE web application to GigaSpaces XAP and the lessons learned from the process of porting the Spring PetClinic sample application to the GigaSpaces platform

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

No Downloads
Views
Total views
3,628
On SlideShare
0
From Embeds
0
Number of Embeds
1,479
Actions
Shares
0
Downloads
56
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Porting Spring PetClinic to GigaSpaces

  1. 1. Migrating JEE Apps to GigaSpaces Case Analysis – Spring PetClinic Uri Cohen, Product Manager Sept. 24 th , 2008
  2. 2. Agenda <ul><li>Background & Motivation </li></ul><ul><li>What’s In an App Server </li></ul><ul><li>Migration in Practice </li></ul><ul><ul><li>Messaging </li></ul></ul><ul><ul><li>Data Access </li></ul></ul><ul><ul><li>Web front end </li></ul></ul><ul><li>Architectural Considerations </li></ul><ul><li>Live Demo </li></ul>
  3. 3. Background <ul><li>GigaSpaces as an application server </li></ul><ul><li>Previous projects to map the migration efforts and gaps </li></ul>
  4. 4. Motivation <ul><li>Feasibility study, learn about: </li></ul><ul><ul><li>User experience (migration complexity) </li></ul></ul><ul><ul><li>Gaps between JEE & GigaSpaces </li></ul></ul><ul><ul><li>Use that as input for next releases planning </li></ul></ul><ul><li>Share outcome with user community </li></ul><ul><ul><li>Provide a common basis for compatison </li></ul></ul><ul><ul><li>“ Here’s how it should be done with GigaSpaces” </li></ul></ul>
  5. 5. What’s In an App Server? <ul><li>Data access </li></ul><ul><li>Messaging / event processing </li></ul><ul><li>Remoting </li></ul><ul><li>TX management </li></ul><ul><li>Web </li></ul>
  6. 6. Migration in Practice <ul><li>Messaging / event processing </li></ul><ul><ul><li>Replace MDBs with GigaSpaces event listeners </li></ul></ul><ul><li>Remoting </li></ul><ul><ul><li>Replace SLSBs with GigaSpaces SVF (Remoting/Executors) </li></ul></ul><ul><li>Data access </li></ul><ul><ul><li>Use GigaSpaces 2 nd cache for Hibernate </li></ul></ul><ul><ul><li>Convert your DAOs to use GigaSpaces, use mirror to persist </li></ul></ul><ul><li>TX management </li></ul><ul><ul><li>Use Spring… </li></ul></ul><ul><li>Web </li></ul><ul><ul><li>Use GigaSpaces web processing unit </li></ul></ul><ul><ul><li>Use GS HTTP session replication </li></ul></ul>
  7. 7. Migration in Practice 1 No No Web (Http Session) 2-3 1 1 Effort (3 is biggest) Yes <ul><li>ORM 2 nd level cache: No </li></ul><ul><li>DAO: Yes </li></ul>Data Access Yes No Remoting Yes Minor to none Messaging Config change Code change Converted Layer
  8. 8. Converting Your Messaging Layer <ul><li>Convert you MDBs to GigaSpaces event containers </li></ul><ul><li>You can use IMessageConverter on the client side </li></ul><ul><li>You can use annotations / XML </li></ul><ul><li>Considerable performance boost </li></ul><ul><ul><li>Without affinity: up to 3 times faster </li></ul></ul><ul><ul><li>With affinity: up to 6 times faster </li></ul></ul>
  9. 9. Converting Your Messaging Layer
  10. 10. Converting Your Messaging Layer
  11. 11. Converting Your Remoting Layer <ul><li>Usually implemented by SLSBs with JEE </li></ul><ul><li>No or minor code changes needed </li></ul><ul><li>You get: </li></ul><ul><ul><li>Location transparency </li></ul></ul><ul><ul><li>Dynamic service discovery </li></ul></ul><ul><ul><li>Synchronous or asynchronous invocation </li></ul></ul><ul><ul><li>Cluster wide invocations (Map/Reduce) </li></ul></ul><ul><ul><li>Data affinity </li></ul></ul><ul><ul><li>Automatic failover </li></ul></ul>
  12. 12. <ul><li>Service Interface </li></ul><ul><li>Client: </li></ul><ul><li>Server: </li></ul>Converting Your Remoting Layer
  13. 13. Converting Your Data Access Layer <ul><li>Currently this is not effortless </li></ul><ul><li>1 st step: Domain model </li></ul><ul><ul><li>Dealing with relationships </li></ul></ul><ul><ul><ul><li>Need to change domain model </li></ul></ul></ul><ul><ul><ul><ul><li>Add foreign key fields, update setter, O/R mappings (if you use mirror) </li></ul></ul></ul></ul><ul><ul><ul><li>No lazy loading </li></ul></ul></ul><ul><ul><ul><ul><li>Load on a per case basis, might mean you should change the DAO </li></ul></ul></ul></ul><ul><ul><ul><li>No object navigation and aggregations in queries </li></ul></ul></ul><ul><ul><ul><ul><li>Need to query the space multiple times and aggregate </li></ul></ul></ul></ul>
  14. 14. Converting Your Data Access Layer <ul><li>2 nd Step: Partitioning </li></ul><ul><ul><li>You should determine how objects will be partitioned </li></ul></ul><ul><ul><li>May involve duplicating parent routing fields to nested objects </li></ul></ul><ul><li>3 rd Step: Changing the DAO </li></ul><ul><ul><li>Naive approach: Convert all JDBC/Hibernate calls to space calls </li></ul></ul><ul><ul><li>Better approach: Use Remoting/Executors, take advantage of data affinity and collocation </li></ul></ul>
  15. 15. Converting Your Data Access Layer <ul><li>Other issues: </li></ul><ul><ul><li>Non String IDs: need to create cluster-wide ID generator </li></ul></ul><ul><ul><li>No dirty checks: similar to lazy loading, need to persist on a case-by-case basis </li></ul></ul><ul><ul><li>Semantics: </li></ul></ul><ul><ul><ul><li>When saving with Hibernate/JPA, generated ID is injected into the object </li></ul></ul></ul><ul><ul><ul><li>Solve at the DAO level </li></ul></ul></ul>
  16. 16. Architectural Considerations <ul><li>Web app & space in the same PU </li></ul><ul><ul><li>Partitioned or replicated? </li></ul></ul><ul><ul><li>Is it really collocation? </li></ul></ul><ul><ul><li>No dynamic scaling </li></ul></ul><ul><li>Web app & space in separate PUs </li></ul><ul><ul><li>Separate scaling models – more flexible </li></ul></ul><ul><ul><li>No collocation </li></ul></ul><ul><ul><ul><li>Local cache can help </li></ul></ul></ul>
  17. 17. Let’s See It in Action
  18. 18. Future Roadmap (Suggestions) <ul><li>Object navigation in queries </li></ul><ul><ul><li>user.address.street=’Oxford’ </li></ul></ul><ul><li>Native aggregate functions </li></ul><ul><ul><li>max, min, avg, std, custom </li></ul></ul><ul><li>Relationships </li></ul><ul><ul><li>JPA support </li></ul></ul><ul><li>Embedded EJB container? </li></ul>
  19. 19. Q&A

×