1 / 25

Building Scalable .NET Applications

Building Scalable .NET Applications. Guy Nirpaz, EVP R&D, GigaSpaces Technologies. 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

mikaia
Download Presentation

Building Scalable .NET Applications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation 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-effectivealternative

  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 • Hard to install: • Bound to static resources (IPs, disk drives, etc.) • Separate clustering model for each tier • Hard to maintain • Non-scalable Web Tier Load Balancer Back-up Back-up Back-up Messaging

  8. Peak loads are unpredictable Constant transaction, data and user growth Volatile and unpredictable loads

  9. Scalability Disasters Are More Common Than Ever • Lost customers • Lost revenues • Brand damage

  10. Micro-Blogging (ala Twitter) Example Application Application Read Service Read Service IIS Publish Service Publish Service Data Base Users Load Balancer IIS

  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 Application Application Application Application Read Service Read Service Read Service Read Service The database becomes the bottleneck IIS IIS Publish Service Publish Service Publish Service Publish Service Data Base Load Balancer IIS IIS IIS IIS

  13. Reader – Database Implementation public ICollection<Post> GetUserPosts(string userID, DateTime fromDate) { // Create command: IDbCommand dbCommand = _dbConnection.CreateCommand(); dbCommand.CommandText = String.Format( "SELECT * FROM Post WHERE UserID='{0}' AND PostedOn > {1}", 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 • Reduced Network hops (if in-process) • Suitable for read-mostly apps Application Read Service Publish Service Users Load Balancer Data Base Cache Service IIS

  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 IIS Users Load Balancer Data Base IIS Space Space Space Space Space Reader Reader Reader Reader Reader IIS Writer Writer Writer Writer Writer IIS

  17. Post Life Cycle Reader Writer Poster Load Balancer Post.NEW IIS ReaderClient Post.VALID Space Writer Client 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 IIS ReaderClient Space Writer Client Post Post Post Reader

  21. Step II – Linear Scalability: Partitioning and Collocation IIS Users Load Balancer Data Base IIS Space Space Space Space Space Reader Reader Reader Reader Reader IIS Writer Writer Writer Writer Writer • Collocation – write/read within the same process • Partitioning and Content-Based Routing • Async Writes to the Database IIS

  22. Step III – Dynamic Scalability Monitor Provision Users Load Balancer Data Base IIS Space Space Space Reader Reader Reader IIS Writer Writer Writer • SLA Driven Policies • Dynamic Scalability • Self healing

  23. 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 Space Based Architecture Values

  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

More Related