Your SlideShare is downloading. ×
Building Scalable .NET Apps
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Building Scalable .NET Apps

2,321
views

Published on

SDC presentation about the subject

SDC presentation about the subject

Published in: Technology

1 Comment
3 Likes
Statistics
Notes
  • Well presented no doubt distributed cache (like NCache and the one you mentioned) can make application highly scalable.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
2,321
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
1
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Building Scalable .NET Applications Guy Nirpaz, EVP R&D, GigaSpaces Technologies
  • 2. Who am I? • 3 Years with GigaSpaces – VP of R&D – Speaker at dev conferences: • Agile, Technology, Architecture • Veteran of several Startups • Spent most of my life in design and architecture of complex systems – Financial Services, Command and Control, Teleco – Mercury, IBM, others • Contact: – guyn@gigspaces.com – @gnirpaz – Twitter – jroller.com/gnirpaz - Blog
  • 3. About GigaSpaces • A Scale-Out Platform, optimized for distributed and virtualized environments: – Any deployment environments: clouds, grids, commodity servers, multi-core – Any languages: Spring/Java, .Net, C++, Dynamic • Driven by the need for: – confidence to handle unpredictable demand and peak loads; – guaranteed performance under any processing loads; – cost-effective, on-demand scalability for clouds and grids – rapidly develop, change and scale applications
  • 4. Explore technical and business challenges of building scalable applications. Analyze fundamental architecture limitations and propose cost-effective alternative
  • 5. The typical scenario… Michael Jackson Tickets are on Sale! Your Application
  • 6. Solution: Linear and Dynamic Scalability Linear Dynamic Scalability
  • 7. Traditional Tier Based Architecture is not scalable Business tier • Relies on centralized resources • HardTier install: to Web • Bound to static resources (IPs, disk drives, Load Balancer etc.) • Separate clustering model for each tier • Hard to maintain Back-up Back-up • Non-scalable Back-up Messaging
  • 8. Peak loads are unpredictable • Constant transaction, data and user growth • Volatile and unpredictable loads 1,300,000,000 1,200,000,000 1,100,000,000 1,000,000,000 900,000,000 800,000,000 700,000,000 600,000,000 500,000,000 400,000,000 300,000,000 200,000,000 100,000,000 0 J-04 M-04 M-04 J-04 S-04 N-04 J-05 M-05 M-05 J-05 S-05 N-05 J-06 M-06 M-06 J-06 S-06 N-06 J-07 M-07 M-07 J-07 S-07
  • 9. Scalability Disasters Are More Common Than Ever • Lost customers • Lost revenues • Brand damage
  • 10. Micro-Blogging (ala Twitter) Example Read Service IIS Publish Service Load Users Balancer Application Data Base Read Service IIS Publish Service Application
  • 11. Reader/Publisher Service namespace MicroBlog.Services { public interface IReaderService { ICollection<Post> GetUserPosts(String userID); ICollection<Post> GetUserPosts(String userID, DateTime fromDate); } } namespace MicroBlog.Services { public interface IPublisherService { void PublishPost(Post post); } }
  • 12. What happens on success Users Read The database becomes Service the bottleneck Read IIS Service Publish Service Load IIS Publish Balancer Service Application Data IIS Application Base Read Service Read IIS Service Publish IIS Service Publish Service IIS Application Application
  • 13. Reader – Database Implementation public ICollection<Post> GetUserPosts(string userID, DateTime fromDate) { // Create command: IDbCommand dbCommand = _dbConnection.CreateCommand(); dbCommand.CommandText = String.Format( quot;SELECT * FROM Post WHERE UserID='{0}' AND PostedOn > {1}quot;, userID, fromDate); // Execute command: IDataReader dataReader = dbCommand.ExecuteReader(); // Translate results from db records to .NET objects: List<Post> result = ReadPostsFromDataReader(dataReader); // Return results: return result; }
  • 14. Step I – Remove DB Bottlenecks with Caching • Reduce I/O bottlenecks – less DB access • In-Memory caching Load Users Balancer • Reduced Network hops (if in- Read Cache Data IIS Service Service process) Base Publish • Suitable for read-mostly apps Service Application
  • 15. Reader – Space Implementation public ICollection<Post> GetUserPosts(String userID) { // Create a template to get all posts by a user id: Post template = new Post(); template.UserID = userID; // Use space proxy to read entries matching template: Post[] result = _spaceProxy.ReadMultiple(template); // Return result: return result; }
  • 16. Step II – Linear Scalability: Partitioning and Collocation Reader Space Writer Reader Space Writer IIS Load Users Balancer Reader Space IIS Data Writer Base IIS Reader Space IIS Writer Reader Space Writer
  • 17. Post Life Cycle Reader Writer Poster Load Post.NEW Balancer Reader Client Post.VALID Writer Client Space IIS Reader
  • 18. Writer Client public class SpacePublisherService : IPublisherService { private readonly ISpaceProxy _spaceProxy; public void PublishPost(Post post) { this._spaceProxy.Write(post); } }
  • 19. Event Driven Programming – Writer Example [PollingEventDriven, TransactionalEvent] public class PendingPostsProcessor { [DataEventHandler] public Post ProcessPendingPost(Post post) { PostStatus newStatus = PostStatus.Published; foreach (String illegalWord in _illegalWords) if (post.Subject.Contains(illegalWord) || post.Body.Contains(illegalWord)) { newStatus = PostStatus.Rejected; break; } // Set new status: post.Status = newStatus; } return post; }
  • 20. Read Life Cycle Reader Writer Poster Load Balancer Reader Client Writer Post Client Post Space Post IIS Reader
  • 21. Step II – Linear Scalability: Partitioning and Collocation Reader Space Writer Reader Space Writer IIS Load Users Balancer Reader Space IIS Data Writer Base IIS Reader Space • Collocation – write/read within the same process IIS Writer • Partitioning and Content-Based Routing Reader Space • Async Writes to the DatabaseWriter
  • 22. Step III – Dynamic Scalability Monitor Provision Reader Space Writer Load Users Balancer Reader Space IIS Data Writer Base IIS Reader Space • SLA Driven Policies Writer • Dynamic Scalability • Self healing
  • 23. Space Based Architecture Values • Linear Scalability – Predictable cost model – pay per value – Predictable growth model • Dynamic – On demand – grow only when needed – Scale back when resources are not needed anymore • SLA Driven – Automatic – Self healing – Application aware • Simple – Non intrusive programming model – Single clustering Model
  • 24. Questions?
  • 25. GigaSpaces Home Page: http://www.gigaspaces.com/ GigaSpaces XAP Product Overview: http://www.gigaspaces.com/wiki/display/XAP7/Concepts GigaSpaces XAP for the Cloud: http://www.gigaspaces.com/cloud