• Save
Dont call me cache april 17
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Dont call me cache april 17

on

  • 2,525 views

 

Statistics

Views

Total Views
2,525
Views on SlideShare
934
Embed Views
1,591

Actions

Likes
3
Downloads
0
Comments
0

5 Embeds 1,591

http://www.gigaspaces.com 1572
http://www.gigaspaces.rsvp1.com 10
http://translate.googleusercontent.com 6
http://d3a0pn6rx5g9yg.cloudfront.net 2
http://sharptoolbox.com 1

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Dont call me cache april 17 Presentation Transcript

  • 1. Powering Your Application with XAP(Using payment processing as an example)“Don’t call me cache”
  • 2. Short Intro to Caching EvolutionCacheIn process cachingof Key->Value datastructureDistribute CachePartitioned cachenodesIMDGPartitioned systemof recordIn MemoryApplication PlatformCollocated IMDG andProcessingCacheCache is good for repetitive data readsBut it is limited in capacityIt also doesn’t handle write-heavy scenarios
  • 3. Short Intro to Caching EvolutionCacheIn process cachingof Key->Value datastructureDistribute CachePartitioned cachenodesIMDGPartitioned systemof recordIn MemoryApplication PlatformCollocated IMDG andProcessingDistribute CacheAllows you to distribute your cache over numerous machines so you getIncreased CapacityBut it doesn’t support write heavy scenariosIt’s also Limited to query by IdWhat about the rest of your app? - Business logic & messaging??
  • 4. Short Intro to Caching EvolutionCacheIn process cachingof Key->Value datastructureDistribute CachePartitioned cachenodesIMDGPartitioned systemof recordIn MemoryApplication PlatformCollocated IMDG andProcessingIMDG solves these problems!You get increased capacityIMDG is also a System of Record with:Query APIsOptimized data accessData integrityIt solves your write scalability problem.
  • 5. Short Intro to Caching EvolutionCacheIn process cachingof Key->Value datastructureDistribute CachePartitioned cachenodesIMDGPartitioned systemof recordIn MemoryApplication PlatformCollocated IMDG andProcessingIn Memory Application PlatformXAP for end to end scalingIts an IMDG that hosts your Businesslogic & has messaging services!It Provides Parallel processing of dataYou get linear scalabilityYou get high availabilityHow does XAP work?
  • 6. Here’s What a Payment Authorization Process Looks LikePaymentAuthorizationRequestBasic Validation User Profile CheckMerchantProfile CheckPaymentAuthorizationApproved
  • 7. Write the Payment Object to XAPCash RegisterApplication PaymentUser payment Cluster@SpaceId()public Long getId() {return id;}@SpaceRoutingpublic Long getUserId() {return userId;}}@SpaceIndexpublic Long getCardId() {return cardId;}}The primary key of this object in the gridThe grid will use this attribute to routethe object to a particular partitionPayment objectA secondary index for query optimization
  • 8. Write the Payment Object to XAPCash RegisterApplicationUser payment ClusterPayment@SpaceId()public Long getId() {return id;}@SpaceRoutingpublic Long getUserId() {return userId;}}@SpaceIndexpublic Long getCardId() {return cardId;}}The primary key of this object in the gridThe grid will use this attribute to routethe object to a particular partitionPayment objectA Secondary index for query optimization
  • 9. Write the Payment Object to XAPCash RegisterApplicationUser payment ClusterPaymentIndexA Secondary index for query optimization@SpaceId()public Long getId() {return id;}@SpaceRoutingpublic Long getUserId() {return userId;}}@SpaceIndexpublic Long getCardId() {return cardId;}}The primary key of this object in the gridThe grid will use this attribute to routethe object to a particular partitionPayment object
  • 10. Lets Talk About Data Model for a Second
  • 11. User Id (Routing)| User Name|…Card Id| Card Data | UserID (Routing)…Transaction ID | CardId | User ID (Routing)…1  *1  *Data Model
  • 12. Lets Get Back to the Process
  • 13. Payment Validation@EventTemplatepublic SQLQuery<Payment> newPayment(){SQLQuery<Payment> query = new SQLQuery(“ status = ? ”)query.setParameter(1,”New”)return query;}QueuePaymentValidator
  • 14. Payment Validation@SpaceDataEventPayment authorizePayment(Payment payment) {space.read(new User(payment.getUserId())space.read(new Card(payment.getCardId())if (paymentIsValid(payment) {Space.write(new UserPaymentMsg(payment,getUserId()));Space.write(new VendorPaymentMsg(payment,getUserId()));space.write(new PaymentAutorization(paymentId,Initial))} else {space.write(new PaymentAutorization(paymentId,Rejected))}}QueuePaymentClass PaymentAuthorization{Status status;Boolean userCheck;Boolean vendorCheck;}ValidatorPayment Authorization
  • 15. Basic Validationif (validatePayment(payment,user,card)) {gigaSpace.write(userPaymentMsg);gigaSpace.write(vendorPaymentMsg);gigaSpace.write(paymentAuthorization);payment.setPaymentStatus(Payment.PaymentStatus.Processing);} else {payment.setPaymentStatus(Payment.PaymentStatus.SuspectedFraud);}Class PaymentAutorization {Status status;Boolean userCheck;Boolean vendorCheck;}UserValidationVendorValidationPaymentAuthorizationQueueQueueQueue Validator
  • 16. User Validation@SpaceDataEventvoid processUserPaymentValidation() {space.readMultiple(new Card(userId))space.readMultiple(new Payment(userId))if (valid()) {IdQuery<PaymentAutjorzation> idQuery = newIdQuery<PaymentAuthorization>(PaymentAuthorization.class, paymentId);space.change(idQuery, new ChangeSet().set(“userCheck", true));} else { ... }}Class PaymentAuthorization{Enum StatusBoolean userCheckBoolean vendorCheck}ReadMessageProcessQueueUserCreditCardPaymentQuerying
  • 17. User Validation@SpaceDataEventvoid processUserPaymentValidation() {space.readMultiple(new Card(userId))space.readMultiple(new Payment(userId))if (valid()) {IdQuery<PaymentAuthoirzation> idQuery = newIdQuery<PaymentAuthorization>(PaymentAuthorization.class, paymentId);space.change(idQuery, new ChangeSet().set(“userCheck", true));} else { ... }}ReadMessageProcessQueueUserCreditCardPaymentClass PaymentAuthorization {Status status;Boolean userCheck;Boolean vendorCheck;}Querying
  • 18. User ValidationReadMessageProcessQueueUserCreditCardPayment@SpaceDataEventvoid processUserPaymentValidation() {space.readMultiple(new Card(userId))space.readMultiple(new Payment(userId))if (valid()) {IdQuery<PaymentAutjorzation> idQuery = newIdQuery<PaymentAuthorization>(PaymentAuthoirzation.class, paymentId);space.change(idQuery, new ChangeSet().set(“userCheck", true));} else { ... }}Class PaymentAuthorization {Status status;Boolean userCheck;Boolean vendorCheck;}Querying
  • 19. Vendor Validationpublic void validateVendor(VendorPaymentMsg vendorPaymentMsg,GigaSpace gigaSpace) {AsyncFuture<Boolean> future = vendorGigaSpace.execute(new VendorValidationTask(vendorPaymentMsg),vendorPaymentMsg.getMerchant());IdQuery<PaymentAuthorization> idQuery = newIdQuery<PaymentAuthorization>(PaymentAuthorization.class,vendorPaymentMsg.getPaymentId());if (future.get()) gigaSpace.change(idQuery, new ChangeSet().set("vendorCheck", true));else gigaSpace.change(idQuery, new ChangeSet().set("vendorCheck”, false));}ReadMessageProcessQueueTaskclass PaymentAuthoirzation {Status status;Boolean userCheck;Boolean vendorCheck;}
  • 20. Vendor Validation@SpaceDataEventpublic void processVendorPaymentValidation() {AsyncFuture<Boolean> result= space.execute(new DistributedTask(new VendorValidationTask(Payment)))if (result.get()) {IdQuery<PaymentAutjorzation> idQuery = newIdQuery<PaymentAuthorization>(PaymentAuthorization.class,paymentId);space.change(idQuery, new ChangeSet().set(“vendorCheck”, true));} else { ... }}Payment ClusterTaskVendor ClusterClass PaymentAuthorization {Status status;Boolean userCheck;Boolean vendorCheck;}
  • 21. Vendor Validationpublic void validateVendor(VendorPaymentMsg vendorPaymentMsg,GigaSpace gigaSpace) {AsyncFuture<Boolean> future = vendorGigaSpace.execute(newVendorValidationTask(vendorPaymentMsg),vendorPaymentMsg.getMerchant());IdQuery<PaymentAuthorization> idQuery = newIdQuery<PaymentAuthorization>(PaymentAuthorization.class,vendorPaymentMsg.getPaymentId());if (future.get()) gigaSpace.change(idQuery, newChangeSet().set("vendorCheck", true));else gigaSpace.change(idQuery, new ChangeSet().set("vendorCheck", false));}Payment Cluster Vendor ClusterTaskClass PaymentAuthorization {Status status;Boolean userCheck;Boolean vendorCheck;}
  • 22. Vendor ValidationPayment Cluster Vendor ClusterTaskpublic void validateVendor(VendorPaymentMsg vendorPaymentMsg,GigaSpace gigaSpace) {AsyncFuture<Boolean> future = vendorGigaSpace.execute(newVendorValidationTask(vendorPaymentMsg),vendorPaymentMsg.getMerchant());IdQuery<PaymentAuthorization> idQuery = newIdQuery<PaymentAuthorization>(PaymentAuthorization.class,vendorPaymentMsg.getPaymentId());if (future.get()) gigaSpace.change(idQuery, newChangeSet().set("vendorCheck", true));else gigaSpace.change(idQuery, new ChangeSet().set("vendorCheck", false));}Class PaymentAuthorization {Status status;Boolean userCheck;Boolean vendorCheck;}
  • 23. Vendor Validation Check@Overridepublic Boolean execute() throws Exception {return validatePayment(vendorPaymentMsg);}TaskDealsMerchantClass PaymentAuthorization {Status status;Boolean userCheck;Boolean vendorCheck;}Querying
  • 24. Vendor Validation CheckTaskDealsMerchant@Overridepublic Boolean execute() throws Exception {return validatePayment(vendorPaymentMsg);}Class PaymentAuthorization {Status status;Boolean userCheck;Boolean vendorCheck;}Querying
  • 25. Vendor ValidationPayment Cluster Vendor ClusterCallback Taskpublic void validateVendor(VendorPaymentMsg vendorPaymentMsg,GigaSpace gigaSpace) {AsyncFuture<Boolean> future = vendorGigaSpace.execute(newVendorValidationTask(vendorPaymentMsg),vendorPaymentMsg.getMerchant());IdQuery<PaymentAuthorization> idQuery = newIdQuery<PaymentAuthorization>(PaymentAuthorization.class,vendorPaymentMsg.getPaymentId());if (future.get()) gigaSpace.change(idQuery, newChangeSet().set("vendorCheck", true));else gigaSpace.change(idQuery, new ChangeSet().set("vendorCheck", false));}Class PaymentAuthorization {Status status;Boolean userCheck;Boolean vendorCheck;}
  • 26. Yey! Payment Has Been Authorized@EventTemplatepublic PaymentAuthorization getNewPayment() {return new PaymentAuthorization(null, true, true, PaymentAuthorizationStatus.New);}QueuePaymentAuthorization