Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Creating a Service
Platform for .NET
Clement EscoffierClement Escoffier –– PhD StudentPhD Student
University ofUniversity ...
LSRLSR--IMAG :IMAG : LogicielsLogiciels,, SystSystèèmesmes && RRééseauxseaux
•• LSR :LSR :
–– Software, Systems & Networks...
ObjectObjectWebWeb
•• ObjectObjectWebWeb
–– Open Source MiddlewareOpen Source Middleware
–– ConsortiumConsortium
•• NonNon...
ContextContext
•• OSGi specifications areOSGi specifications are JavaJava--centriccentric
•• Microsoft .NETMicrosoft .NET
...
OutlineOutline
•• .NET overview.NET overview
•• Goals ofGoals of OSGi.NETOSGi.NET
•• Issues & alternative approachesIssues...
Microsoft .NETMicrosoft .NET
•• .NET initiative announced in July 2000 by Microsoft.NET initiative announced in July 2000 ...
.NET Framework Overview.NET Framework Overview
•• CLR : Common Language RuntimeCLR : Common Language Runtime
–– Support of...
.NET Framework Overview : Assembly.NET Framework Overview : Assembly
•• Assemblies :Assemblies :
–– Set of classes, resour...
.NET Framework Overview : Application Domain.NET Framework Overview : Application Domain
•• Application Domain (Applicatio...
.NET Framework Overview : Java.NET Framework Overview : Java vsvs .NET.NET
JavaJava .NET.NET
Virtual MachineVirtual Machin...
OSGi.NETOSGi.NET : Goals: Goals
•• Implement OSGi specification on .NETImplement OSGi specification on .NET
MailService
Ma...
Key Technical DifferencesKey Technical Differences
•• Technical differences between .NET and JavaTechnical differences bet...
Alternative Implementation ApproachesAlternative Implementation Approaches
•• Four alternative approachesFour alternative ...
MonoMono--application domainapplication domain
•• 1 Bundle = 1 Assembly1 Bundle = 1 Assembly
•• 1 Application domain for1 ...
MonoMono--Application DomainApplication Domain
•• Service invocationService invocation ………………………………………………………….... OkOk
•• ...
MultiMulti--Application DomainApplication Domain
•• 1 bundle inside 1 application domain1 bundle inside 1 application doma...
MultiMulti--Application DomainApplication Domain
•• Service invocationService invocation ………………………………………………………… Ok/NoOk/No...
Hybrid SolutionHybrid Solution
•• Mix the 2 previous solutionsMix the 2 previous solutions
–– Different services set insid...
Hybrid SolutionHybrid Solution
AppDomain 2
Operating System
Common Language Runtime
AppDomain 1
AppDomain 0 : OSGi.NET
Rem...
The Hybrid SolutionThe Hybrid Solution
•• Service invocationService invocation …………………………………………………………………………..……....OkOk
––...
CLR ModificationCLR Modification
•• Introspection of an application domainIntrospection of an application domain
Operating...
CLR Modification in ROTORCLR Modification in ROTOR
•• The approach :The approach :
–– modification of the internal class l...
CLR ModificationCLR Modification
•• Service InvocationService Invocation …………………………………………………………....OkOk
•• Service apparit...
Alternatives SummaryAlternatives Summary
1 2 3 4
Hybrid
solution
CLR
Modification
ROTOR with
a lot of
modifications
Standa...
ConclusionConclusion
•• .NET.NET
–– WellWell--known virtual machineknown virtual machine
–– Distributed with Windows XPDis...
PerspectivesPerspectives
•• OSGi Release 4OSGi Release 4
–– More difficult (more sophisticated class sharing &More difficu...
Questions ???Questions ???
ROTORROTOR
•• Shared Source CLI :Shared Source CLI :
–– Distributed by MicrosoftDistributed by Microsoft
–– Very close wit...
MultiMulti--Domain Approach : BenchmarkDomain Approach : Benchmark
•• Method invocation timeMethod invocation time
–– Call...
Creating a Service Platform for .NET - Clément Escoffier, University of Grenoble
Upcoming SlideShare
Loading in …5
×

Creating a Service Platform for .NET - Clément Escoffier, University of Grenoble

224 views

Published on

OSGi World Congress 2005 - Developer Forum Day 2

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Creating a Service Platform for .NET - Clément Escoffier, University of Grenoble

  1. 1. Creating a Service Platform for .NET Clement EscoffierClement Escoffier –– PhD StudentPhD Student University ofUniversity of GrenobleGrenoble
  2. 2. LSRLSR--IMAG :IMAG : LogicielsLogiciels,, SystSystèèmesmes && RRééseauxseaux •• LSR :LSR : –– Software, Systems & NetworksSoftware, Systems & Networks –– IMAG federationIMAG federation –– Member of theMember of the ObjectObjectWebWeb consortiumconsortium
  3. 3. ObjectObjectWebWeb •• ObjectObjectWebWeb –– Open Source MiddlewareOpen Source Middleware –– ConsortiumConsortium •• NonNon--profit, open, business neutralprofit, open, business neutral •• IndustryIndustry--grade projectsgrade projects •• Compliance with open standardsCompliance with open standards
  4. 4. ContextContext •• OSGi specifications areOSGi specifications are JavaJava--centriccentric •• Microsoft .NETMicrosoft .NET –– Virtual MachineVirtual Machine –– Well knownWell known –– Already deployed with Windows XPAlready deployed with Windows XP –– Able to load and to unload dynamic codeAble to load and to unload dynamic code •• Why not implement OSGi R3 specifications onWhy not implement OSGi R3 specifications on .NET ?.NET ?
  5. 5. OutlineOutline •• .NET overview.NET overview •• Goals ofGoals of OSGi.NETOSGi.NET •• Issues & alternative approachesIssues & alternative approaches •• Conclusion & perspectivesConclusion & perspectives
  6. 6. Microsoft .NETMicrosoft .NET •• .NET initiative announced in July 2000 by Microsoft.NET initiative announced in July 2000 by Microsoft –– COM+, ASP, XML, SOAP, WSDL, UDDICOM+, ASP, XML, SOAP, WSDL, UDDI –– Microsoft .NET, Mono, Shared Source CLI, Compact .NETMicrosoft .NET, Mono, Shared Source CLI, Compact .NET •• .NET Goals :.NET Goals : –– Distributed computing and mainly InternetDistributed computing and mainly Internet –– ComponentizationComponentization –– Enterprise servicesEnterprise services Operating System .NET Enterprise Servers .NET Framework .NET Building Block Services Exchange Server; SQL Server … Microsoft Passport, … Microsoft Visual Studio .NET
  7. 7. .NET Framework Overview.NET Framework Overview •• CLR : Common Language RuntimeCLR : Common Language Runtime –– Support of several languages (C#, J#,Support of several languages (C#, J#, Cobol.NETCobol.NET)) –– Interpretation of MSIL CodeInterpretation of MSIL Code Operating System Common Language Runtime (debug, exception, JIT …) Framework Base Classes Data & XML classes Web Services Web Forms Win Forms Framework
  8. 8. .NET Framework Overview : Assembly.NET Framework Overview : Assembly •• Assemblies :Assemblies : –– Set of classes, resources and metadataSet of classes, resources and metadata –– Support of versionSupport of version –– Possibility to sign an assemblyPossibility to sign an assembly –– Unit of packaging & deploymentUnit of packaging & deployment –– Unit of loadingUnit of loading
  9. 9. .NET Framework Overview : Application Domain.NET Framework Overview : Application Domain •• Application Domain (Application Domain (AppdomainAppdomain)) –– Isolated Execution EnvironmentIsolated Execution Environment •• An application runs in an application domainAn application runs in an application domain •• Several application domains in one CLRSeveral application domains in one CLR •• Virtual processVirtual process –– Assemblies are loaded inside application domainAssemblies are loaded inside application domain –– Unloading unitUnloading unit Common Language Runtime AppDomain1 AppDomain2 ASM 1 ASM 2 ASM1.dll ASM2.dll ASM3.dllASM 3
  10. 10. .NET Framework Overview : Java.NET Framework Overview : Java vsvs .NET.NET JavaJava .NET.NET Virtual MachineVirtual Machine JVMJVM CLRCLR LanguagesLanguages JavaJava (supported by Sun)(supported by Sun) C# (ECMA & ISO)C# (ECMA & ISO) J#, VB.NETJ#, VB.NET …… Internal languageInternal language Byte codeByte code MSILMSIL Deployment UnitDeployment Unit Classes, JARClasses, JAR AssembliesAssemblies Load unitLoad unit ClassesClasses AssembliesAssemblies Unload UnitUnload Unit Classes (GarbageClasses (Garbage Collector)Collector) Application domainApplication domain
  11. 11. OSGi.NETOSGi.NET : Goals: Goals •• Implement OSGi specification on .NETImplement OSGi specification on .NET MailService MailwithTemp Temperature HTTPServer VideoontheWeb Camera •• Service InvocationService Invocation •• Dynamic Code LoadingDynamic Code Loading •• Dynamic Code UnloadingDynamic Code Unloading •• Code SharingCode Sharing Operating System Common Language Runtime OSGi.NET •• Service arrivalService arrival and departureand departure
  12. 12. Key Technical DifferencesKey Technical Differences •• Technical differences between .NET and JavaTechnical differences between .NET and Java –– Class loading flexibilityClass loading flexibility –– Loading / Unloading systemLoading / Unloading system –– Code sharingCode sharing •• No direct way to map OSGi features onto .NETNo direct way to map OSGi features onto .NET
  13. 13. Alternative Implementation ApproachesAlternative Implementation Approaches •• Four alternative approachesFour alternative approaches –– MonoMono--application domainapplication domain –– MultiMulti--application domainsapplication domains –– Hybrid alternativeHybrid alternative –– CLR modificationCLR modification
  14. 14. MonoMono--application domainapplication domain •• 1 Bundle = 1 Assembly1 Bundle = 1 Assembly •• 1 Application domain for1 Application domain for OSGi.NETOSGi.NET & Services& Services Operating System Common Language Runtime ASM 1 : Provider Loader Application domain ASM 2 : Requester ASM 3 : Contract Registry
  15. 15. MonoMono--Application DomainApplication Domain •• Service invocationService invocation ………………………………………………………….... OkOk •• Service arrival & departureService arrival & departure …………....………………………….. OkOk •• Dynamic loadingDynamic loading ……………………..………………………………………… OkOk •• Code sharingCode sharing ……………………………………………………………………...... NoNo –– All loaded code is shared inside an application domainAll loaded code is shared inside an application domain –– Does not support private codeDoes not support private code •• Dynamic unloadingDynamic unloading ………………………………………………………….. NoNo
  16. 16. MultiMulti--Application DomainApplication Domain •• 1 bundle inside 1 application domain1 bundle inside 1 application domain •• OSGi.NETOSGi.NET in one application domain, bundlesin one application domain, bundles reside in their own application domainsreside in their own application domains .NET Remoting Operating System Common Language Runtime AppDomain 1 AppDomain 0 : OSGi.NET Provider AppDomain 3 Contract AppDomain 2 Requester ContractContract LoaderRegistry
  17. 17. MultiMulti--Application DomainApplication Domain •• Service invocationService invocation ………………………………………………………… Ok/NoOk/No –– Service invocation must use .NETService invocation must use .NET RemotingRemoting –– Significant overheadSignificant overhead •• Service arrival & departureService arrival & departure ……....……………………………….. OkOk •• Dynamic loadingDynamic loading …………..…………………………………………………… OkOk –– Not fully transparentNot fully transparent •• Code sharingCode sharing ……………………………………………………………………...... NoNo –– All code is privateAll code is private •• Dynamic unloadingDynamic unloading ………………………………………………………….. OkOk
  18. 18. Hybrid SolutionHybrid Solution •• Mix the 2 previous solutionsMix the 2 previous solutions –– Different services set inside application domainDifferent services set inside application domain –– Allow bindings inside & outside application domainAllow bindings inside & outside application domain –– Different range of services (local /Different range of services (local / ““remoteremote”” services)services) –– Several registries (local and global)Several registries (local and global) •• Trade off for application designerTrade off for application designer –– How to group services into application domainsHow to group services into application domains •• Hypothesized, but not implementedHypothesized, but not implemented
  19. 19. Hybrid SolutionHybrid Solution AppDomain 2 Operating System Common Language Runtime AppDomain 1 AppDomain 0 : OSGi.NET Remote Provider Requester Contract2Contract1 LoaderGlobal Registry Local Provider Registry Contract2 Registry
  20. 20. The Hybrid SolutionThe Hybrid Solution •• Service invocationService invocation …………………………………………………………………………..……....OkOk –– Choice between local service & remote serviceChoice between local service & remote service •• Service apparition & departureService apparition & departure …………………………………………..……........OkOk •• Dynamic loadingDynamic loading ……………………………………………………………………....……......……OkOk •• Code sharingCode sharing ……………………………………………………………………………………..……....NoNo –– Inside application domain, all code is sharedInside application domain, all code is shared –– Outside application domain, no code sharingOutside application domain, no code sharing •• Dynamic unloadingDynamic unloading ………………………………………………………………..……......……OkOk –– Unload an application domain = unload a set ofUnload an application domain = unload a set of servicesservices
  21. 21. CLR ModificationCLR Modification •• Introspection of an application domainIntrospection of an application domain Operating System Common Language Runtime ASM1 Application domain Stub Heap Low Frequency Heap High Frequency Heap CL .NET Object1 .NET Object1 .NET Object2 .NET Object2 Class 2 Set and look in the LFP Set and look in the same memory ASM2 Class 1 CL Class 1Class 1 Class 2Class 2
  22. 22. CLR Modification in ROTORCLR Modification in ROTOR •• The approach :The approach : –– modification of the internal class loadermodification of the internal class loader •• Enable private code sharingEnable private code sharing –– Add a garbage collectorAdd a garbage collector •• Enable unloadingEnable unloading Operating System Common Language Runtime Requester Application domain Stub Heap Low Frequency Heap High Frequency Heap CL Provider CL .NET Object1 .NET Object1 .NET Object2 .NET Object2 Requester-1 Contract-1 LoaderRegistry Contract CL Provider-1
  23. 23. CLR ModificationCLR Modification •• Service InvocationService Invocation …………………………………………………………....OkOk •• Service apparition & departureService apparition & departure ………………………………..OkOk •• Dynamic LoadingDynamic Loading ………………………………………………………………OkOk •• Code sharingCode sharing ……………………………………………………………………......OkOk •• Dynamic UnloadingDynamic Unloading …………………………………………………………OkOk •• But itBut it’’s no longer standard .NET and was toos no longer standard .NET and was too complex to implement within our time constraintscomplex to implement within our time constraints
  24. 24. Alternatives SummaryAlternatives Summary 1 2 3 4 Hybrid solution CLR Modification ROTOR with a lot of modifications Standard CLR Reference Mono application domain Multi Application Domains OSGi Dynamism of services Dynamic code loading Dynamic code unloading Direct Invocation Virtual Machine Standard CLR Standard CLR Standard JVM (>= 1.1)
  25. 25. ConclusionConclusion •• .NET.NET –– WellWell--known virtual machineknown virtual machine –– Distributed with Windows XPDistributed with Windows XP •• OSGi technology is JavaOSGi technology is Java--centriccentric •• Tried to implement OSGi on .NET =>Tried to implement OSGi on .NET => OSGi.NetOSGi.Net –– Four alternativesFour alternatives •• Is any alternative fully compliant with OSGiIs any alternative fully compliant with OSGi specification ?specification ? –– NoNo
  26. 26. PerspectivesPerspectives •• OSGi Release 4OSGi Release 4 –– More difficult (more sophisticated class sharing &More difficult (more sophisticated class sharing & management)management) •• Waiting the next release of the .NET FrameworkWaiting the next release of the .NET Framework –– 2007 ??2007 ?? –– Not yet clear :Not yet clear : •• Unloading assemblies individuallyUnloading assemblies individually •• .NET.NET RemotingRemoting optimizationsoptimizations
  27. 27. Questions ???Questions ???
  28. 28. ROTORROTOR •• Shared Source CLI :Shared Source CLI : –– Distributed by MicrosoftDistributed by Microsoft –– Very close with the official frameworkVery close with the official framework –– Contains VM, CompilersContains VM, Compilers …… •• Some numbersSome numbers –– 1.9 millions of LOC (C++, C#, MSIL, Assembler)1.9 millions of LOC (C++, C#, MSIL, Assembler) –– 5900 sources files, 9700 files5900 sources files, 9700 files –– Kernel (Kernel (mscorlibmscorlib) : 867 classes in C++) : 867 classes in C++ •• DiscussionsDiscussions –– With the DOTNETWith the DOTNET--ROTOR mailing listROTOR mailing list –– Microsoft newsgroupsMicrosoft newsgroups
  29. 29. MultiMulti--Domain Approach : BenchmarkDomain Approach : Benchmark •• Method invocation timeMethod invocation time –– Calls intraCalls intra--application domainapplication domain vsvs Calls interCalls inter--applicationapplication domaindomain –– Processor 1Processor 1 GhzGhz, RAM 768 Mo, Windows XP SP2,, RAM 768 Mo, Windows XP SP2, CLR 1.1CLR 1.1 Void Small Object Medium Object Huge Object 0 20 40 60 80 100 120 140 160 180 Temps des appels locaux Tempsenms Void Small Object Medium Object Huge Object 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 11000 12000 Appel locaux via .Net Remoting Tempsenms Intra Domain Calls Inter Domains Calls Timeinms Timeinms

×