Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ingo Rammer thinktecture.

Similar presentations


Presentation on theme: "Ingo Rammer thinktecture."— Presentation transcript:

1 Ingo Rammer ingo.rammer@thinktecture.com thinktecture

2 Support and consulting for software architects and developers Application Optimization, Troubleshooting, Debugging Architectural Consulting and Prototyping Developer-Coaching and -Mentoring Architecture and Code Reviews http://www.thinktecture.com ingo.rammer@thinktecture.com

3 Project Velocity is a Windows Service which provides highly scalable, distributed, cache- aside caching infrastructure spanning multiple physical nodes... and it will quite likely be free and released mid 2009

4 Web Server #1 Web Server #2 Web Server #3 Web Server #n Load Balancer Data Store Users

5 Web Server Data Store Application Memory Session State Local Caching

6 Web Server #1 Web Server #2 Web Server #3 Web Server #n Load Balancer Cache Server #1 Cache Server #2 Velocity Caching

7 Web Server #1 Web Server #2 Web Server #3 Web Server #n Load Balancer Cache Server #1 Cache Server #2 V V V V V V V V V V V V

8 Today CTP2/CTP3 Configuration Server: Cluster XML or SQL Server Client: App.Config or code Administration Powershell - can be used from any node in the cluster

9 In Powershell admin New-Cache -cachename democache Store/Retrieve items DataCacheFactory fact = new DataCacheFactory(); DataCache myCache = fact.GetCache("democache2"); string someValue = "testing"; // anything [Serializable] string someKey = "myKey"; myCache.Put(someKey, someValue); string result = (string) myCache[someKey]; DataCacheFactory fact = new DataCacheFactory(); DataCache myCache = fact.GetCache("democache2"); string someValue = "testing"; // anything [Serializable] string someKey = "myKey"; myCache.Put(someKey, someValue); string result = (string) myCache[someKey];

10 .NET Client Velocity #1 Velocity #2 Velocity #3 Prod-1 Prod-2 Prod-4 Prod-3 DataCache defaultcache = GetCache(...); Product prod = GetProduct(...); defaultcache.Put("Prod-1",prod); DataCache defaultcache = GetCache(...); Product prod = GetProduct(...); defaultcache.Put("Prod-1",prod); defaultcache.Put("Prod-2",prod2); defaultcache.Put("Prod-3",prod3); defaultcache.Put("Prod-4",prod4); defaultcache.Put("Prod-2",prod2); defaultcache.Put("Prod-3",prod3); defaultcache.Put("Prod-4",prod4);

11 Scale on size More machines == more memory Scale on throughput More machines == higher throughput Local Cache Closer to the client == lower latency, higher throughput, higher staleness

12 Can be enabled in config or code Great for reference data which can tolarate staleness Synchronization CTP2: Expiration CTP3: notifications from central caches

13 Velocity #1 Velocity #2 Velocity #3 Prod-1.NET Client Dynamic Routing Table Prod-2 Prod-4 Prod-3 defaultcache.Put("Prod-1",prod);

14 Velocity #1 Velocity #2 Velocity #3 Prod-1.NET Client Dynamic Routing Table Prod-2 Prod-4 Prod-3 object p1 = defaultcache["Prod-1"]; if (p1==null) { p1 = GetProductFromDatabase(...) defaultcache.Put("Prod-1", p1); } object p1 = defaultcache["Prod-1"]; if (p1==null) { p1 = GetProductFromDatabase(...) defaultcache.Put("Prod-1", p1); } Prod-1

15 Reference Data Example: product catalog Does not change dynamically, can be cached locally Can be reloaded from database Activity Data Example: Session, shopping cart Frequent changes, highly partitionable Needs high availability Resource Data Example: product inventory level Changes often, needs staleness decision Maybe "exceed first, apologize later", maybe centralized checks on update on partitioned DB

16 Optimistic (default) and pessimistic locking DataCacheItemVersion ver = default(DataCacheItemVersion); object itm = defaultCache.Get("region", "key", ref ver); // after change (throws an exception if modified in meantime) defaultCache.Put("region","key", itm, ver); DataCacheItemVersion ver = default(DataCacheItemVersion); object itm = defaultCache.Get("region", "key", ref ver); // after change (throws an exception if modified in meantime) defaultCache.Put("region","key", itm, ver); DataCacheLockHandle lockHandle; object itm = defaultCache.GetAndLock("region", "key", TimeSpan.FromSeconds(30), out lockHandle); // after change: defaultCache.PutAndUnlock("region", "key", itm, lockHandle, null); DataCacheLockHandle lockHandle; object itm = defaultCache.GetAndLock("region", "key", TimeSpan.FromSeconds(30), out lockHandle); // after change: defaultCache.PutAndUnlock("region", "key", itm, lockHandle, null);

17 Decide which properties you need Performance - Throughput and Latency Consistency - Staleness Eviction - Can the data be recreated? Security - Who can read/write Availability - Survive node failure Different set of requirements for each kind of data Configuration options in Velocity for these requirements

18 Velocity #1 Velocity #2 Velocity #3 Sess-1 (Primary) Sess-1 (Primary) sessionCache.put("Sess-1", se1); Sess-1 (Secondary) Sess-2 (Primary) Sess-2 (Primary) Sess-2 (Secondary) sessionCache.put("Sess-1", se1); sessionCache.put("Sess-2", se2); sessionCache.put("Sess-1", se1); sessionCache.put("Sess-2", se2);

19 Velocity #1 Velocity #2 Velocity #3 Sess-1 (Primary) Sess-1 (Primary) sessionCache.put("Sess-1", se1); Sess-1 (Secondary) Sess-2 (Primary) Sess-2 (Primary) Sess-2 (Secondary) sessionCache.put("Sess-1", se1); sessionCache.put("Sess-2", se2); sessionCache.put("Sess-1", se1); sessionCache.put("Sess-2", se2); Sess-2 (Primary) Sess-2 (Primary) Sess-2 (Secondary) Sess-1 (Secondary) Sess-1 (Secondary)

20 //... here comes the code... <add name="SessionStoreProvider" type="System.Data.Caching.SessionStoreProvider, ClientLibrary" cacheName="CacheName"/> //... here comes the code... <add name="SessionStoreProvider" type="System.Data.Caching.SessionStoreProvider, ClientLibrary" cacheName="CacheName"/>

21 Optional Support tagging, enumeration and bulk gets (CTP3) Every item in a region lives on the same node! Example use case Session state in which every property can be stored individually within one region Can be used as unit for deletion

22 CTP3: Notifications, callback for cache item changed Version 2: Core features Queryable caches with LINQ Cache-Through instead of cache-aside ASP.NET 4.0 Velocity as System.Caching provider Granular session updates (IPartialSessionState) Velocity as Output caching provider Higher compatibility with Azure and HPC

23 Presentations TechDays: www.techdays.ch MSDN Events: http://www.microsoft.com/switzerland/msdn/de/presentationfinder.mspx MSDN Webcasts: http://www.microsoft.com/switzerland/msdn/de/finder/default.mspxwww.techdays.chhttp://www.microsoft.com/switzerland/msdn/de/presentationfinder.mspxhttp://www.microsoft.com/switzerland/msdn/de/finder/default.mspx MSDN Events MSDN Events: http://www.microsoft.com/switzerland/msdn/de/events/default.mspx Save the date: TechEd 2009 Europe, 9-13 November 2009, Berlinhttp://www.microsoft.com/switzerland/msdn/de/events/default.mspx MSDN Flash (our by weekly newsletter) Subscribe: http://www.microsoft.com/switzerland/msdn/de/flash.mspxhttp://www.microsoft.com/switzerland/msdn/de/flash.mspx MSDN Team Blog RSS: http://blogs.msdn.com/swiss_dpe_team/Default.aspxhttp://blogs.msdn.com/swiss_dpe_team/Default.aspx Developer User Groups & Communities Mobile Devices: http://www.pocketpc.ch/ Microsoft Solutions User Group Switzerland: www.msugs.ch.NET Managed User Group of Switzerland: www.dotmugs.ch FoxPro User Group Switzerland: www.fugs.chhttp://www.pocketpc.ch/www.msugs.chwww.dotmugs.chwww.fugs.ch

24 Presentations TechDays: www.techdays.chwww.techdays.ch TechNet Events TechNet Events: http://technet.microsoft.com/de-ch/bb291010.aspx Save the date: TechEd 2009 Europe, 9-13 November 2009, Berlinhttp://technet.microsoft.com/de-ch/bb291010.aspx TechNet Flash (our by weekly newsletter) Subscribe: http://technet.microsoft.com/de-ch/bb898852.aspxhttp://technet.microsoft.com/de-ch/bb898852.aspx Schweizer IT Professional und TechNet Blog RSS: http://blogs.technet.com/chitpro-de/http://blogs.technet.com/chitpro-de/ IT Professional User Groups & Communities SwissITPro User Group: www.swissitpro.ch NT Anwendergruppe Schweiz: www.nt-ag.ch PASS (Professional Association for SQL Server): www.sqlpass.chwww.swissitpro.chwww.nt-ag.chwww.sqlpass.ch

25 7. – 8. April 2010 Congress Center Basel

26 Classic Sponsoring Partners Media Partner Premium Sponsoring Partners

27

28 //... here comes the code...


Download ppt "Ingo Rammer thinktecture."

Similar presentations


Ads by Google