Building Scalable .NET Applications

Embed Size (px)


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 - PowerPoint PPT Presentation

Text of Building Scalable .NET Applications

  • Building Scalable .NET ApplicationsGuy Nirpaz,EVP R&D, GigaSpaces Technologies

  • Who am I?3 Years with GigaSpacesVP of R&DSpeaker at dev conferences:Agile, Technology, ArchitectureVeteran of several StartupsSpent most of my life in design and architecture of complex systemsFinancial Services, Command and Control, TelecoMercury, IBM, - Blog

  • About GigaSpacesA Scale-Out Platform, optimized for distributed and virtualized environments:Any deployment environments: clouds, grids, commodity servers, multi-coreAny 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

  • Global 1000 Companies Rely on GigaSpaces

  • Your ApplicationThe typical scenario

  • Linear Dynamic ScalabilitySolution: Linear and Dynamic Scalability

  • Business tierBack-upBack-upBack-upLoad BalancerWeb TierMessagingRelies on centralized resourcesHard to install: Bound to static resources (IPs, disk drives, etc.)Separate clustering model for each tierHard to maintainNon-scalableTraditional Tier Based Architecture is not scalable

  • Peak loads are unpredictableConstant transaction, data and user growth Volatile and unpredictable loads

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

  • UsersLoad BalancerMicro-Blogging (ala Twitter) Example

  • Reader/Publisher Servicenamespace MicroBlog.Services{ public interface IReaderService {ICollection GetUserPosts(String userID);

    ICollection GetUserPosts(String userID, DateTime fromDate); }}namespace MicroBlog.Services{ public interface IPublisherService {void PublishPost(Post post); }}

  • UsersLoad BalancerWhat happens on success

  • Reader Database Implementationpublic ICollection 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 result = ReadPostsFromDataReader(dataReader);

    // Return results:return result;}

  • UsersLoad BalancerStep I Remove DB Bottlenecks with CachingReduce I/O bottlenecks less DB accessIn-Memory cachingReduced Network hops (if in-process)Suitable for read-mostly apps

  • Reader Space Implementationpublic ICollection 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;}

  • UsersLoad BalancerStep II Linear Scalability: Partitioning and Collocation

  • PosterLoad BalancerPost Life CycleReader

  • Writer Clientpublic class SpacePublisherService : IPublisherService{ private readonly ISpaceProxy _spaceProxy;

    public void PublishPost(Post post) {this._spaceProxy.Write(post); }}

  • 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;}

  • PosterLoad BalancerRead Life CycleReader

  • UsersLoad BalancerStep II Linear Scalability: Partitioning and CollocationCollocation write/read within the same processPartitioning and Content-Based RoutingAsync Writes to the Database

  • UsersLoad BalancerStep III Dynamic ScalabilitySLA Driven PoliciesDynamic ScalabilitySelf healing

  • Space Based Architecture ValuesLinear ScalabilityPredictable cost model pay per valuePredictable growth modelDynamicOn demand grow only when neededScale back when resources are not needed anymoreSLA DrivenAutomatic Self healingApplication awareSimpleNon intrusive programming modelSingle clustering Model

  • Questions?

  • GigaSpaces Home Page:

    GigaSpaces XAP Product Overview:

    GigaSpaces XAP for the Cloud:

    **********You dont want to see this in the papers, do you?*******