• Save
Building Scalable .NET Apps
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Building Scalable .NET Apps

  • 3,869 views
Uploaded on

SDC presentation about the subject

SDC presentation about the subject

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Well presented no doubt distributed cache (like NCache and the one you mentioned) can make application highly scalable.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
3,869
On Slideshare
3,670
From Embeds
199
Number of Embeds
7

Actions

Shares
Downloads
0
Comments
1
Likes
3

Embeds 199

http://www.jroller.com 181
http://jroller.com 9
http://www.linkedin.com 3
http://www.lmodules.com 2
http://theoldreader.com 2
http://static.slideshare.net 1
http://www.slideshare.net 1

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