Creating a Service
Platform for .NET
Clement Escoffier
Clement Escoffier
–
–
PhD Student
PhD Student
University of
University of
Grenoble
Grenoble
LSR
LSR
-
-
IMAG :
IMAG :
Logiciels
Logiciels
,
,
Syst
Syst
è
è
mes
mes
&
&
R
R
é
é
seaux
seaux
•
•
LSR :
LSR :
–
–
Software, Systems & Networks
Software, Systems & Networks
–
–
IMAG federation
IMAG federation
–
–
Member of the
Member of the
Object
Object
Web
Web
consortium
consortium
Object
Object
Web
Web
•
•
Object
Object
Web
Web
–
–
Open Source Middleware
Open Source Middleware
–
–
Consortium
Consortium
•
•
Non
Non
-
-
profit, open, business neutral
profit, open, business neutral
•
•
Industry
Industry
-
-
grade projects
grade projects
•
•
Compliance with open standards
Compliance with open standards
Context
Context
•
•
OSGi specifications are
OSGi specifications are
Java
Java
-
-
centric
centric
•
•
Microsoft .NET
Microsoft .NET
–
–
Virtual Machine
Virtual Machine
–
–
Well known
Well known
–
–
Already deployed with Windows XP
Already deployed with Windows XP
–
–
Able to load and to unload dynamic code
Able to load and to unload dynamic code
•
•
Why not implement OSGi R3 specifications on
Why not implement OSGi R3 specifications on
.NET ?
.NET ?
Outline
Outline
•
•
.NET overview
.NET overview
•
•
Goals of
Goals of
OSGi.NET
OSGi.NET
•
•
Issues & alternative approaches
Issues & alternative approaches
•
•
Conclusion & perspectives
Conclusion & perspectives
Microsoft .NET
Microsoft .NET
•
•
.NET initiative announced in July 2000 by Microsoft
.NET initiative announced in July 2000 by Microsoft
–
–
COM+, ASP, XML, SOAP, WSDL, UDDI
COM+, ASP, XML, SOAP, WSDL, UDDI
–
–
Microsoft .NET, Mono, Shared Source CLI, Compact .NET
Microsoft .NET, Mono, Shared Source CLI, Compact .NET
•
•
.NET Goals :
.NET Goals :
–
–
Distributed computing and mainly Internet
Distributed computing and mainly Internet
–
–
Componentization
Componentization
–
–
Enterprise services
Enterprise services
Operating System
.NET
Enterprise
Servers
.NET
Framework
.NET
Building
Block Services
Exchange
Server;
SQL Server
…
Microsoft
Passport,
…
Microsoft Visual Studio .NET
.NET Framework Overview
.NET Framework Overview
•
•
CLR : Common Language Runtime
CLR : Common Language Runtime
–
–
Support of several languages (C#, J#,
Support of several languages (C#, J#,
Cobol.NET
Cobol.NET
)
)
–
–
Interpretation of MSIL Code
Interpretation of MSIL Code
Operating System
Common Language Runtime
(debug, exception, JIT …)
Framework Base Classes
Data & XML classes
Web
Services
Web
Forms
Win
Forms
Framework
.NET Framework Overview : Assembly
.NET Framework Overview : Assembly
•
•
Assemblies :
Assemblies :
–
–
Set of classes, resources and metadata
Set of classes, resources and metadata
–
–
Support of version
Support of version
–
–
Possibility to sign an assembly
Possibility to sign an assembly
–
–
Unit of packaging & deployment
Unit of packaging & deployment
–
–
Unit of loading
Unit of loading
.NET Framework Overview : Application Domain
.NET Framework Overview : Application Domain
•
•
Application Domain (
Application Domain (
Appdomain
Appdomain
)
)
–
–
Isolated Execution Environment
Isolated Execution Environment
•
•
An application runs in an application domain
An application runs in an application domain
•
•
Several application domains in one CLR
Several application domains in one CLR
•
•
Virtual process
Virtual process
–
–
Assemblies are loaded inside application domain
Assemblies are loaded inside application domain
–
–
Unloading unit
Unloading unit
Common Language Runtime
AppDomain1
AppDomain2
ASM 1
ASM 2
ASM1.dll
ASM2.dll
ASM3.dll
ASM 3
.NET Framework Overview : Java
.NET Framework Overview : Java
vs
vs
.NET
.NET
Java
Java
.NET
.NET
Virtual Machine
Virtual Machine
JVM
JVM
CLR
CLR
Languages
Languages
Java
Java
(supported by Sun)
(supported by Sun)
C# (ECMA & ISO)
C# (ECMA & ISO)
J#, VB.NET
J#, VB.NET
…
…
Internal language
Internal language
Byte code
Byte code
MSIL
MSIL
Deployment Unit
Deployment Unit
Classes, JAR
Classes, JAR
Assemblies
Assemblies
Load unit
Load unit
Classes
Classes
Assemblies
Assemblies
Unload Unit
Unload Unit
Classes (Garbage
Classes (Garbage
Collector)
Collector)
Application domain
Application domain
OSGi.NET
OSGi.NET
: Goals
: Goals
•
•
Implement OSGi specification on .NET
Implement OSGi specification on .NET
Mail Service
Mail with Temp
Temperature
HTTP Server
Video on the Web
Camera
•
•
Service Invocation
Service Invocation
•
•
Dynamic Code Loading
Dynamic Code Loading
•
•
Dynamic Code Unloading
Dynamic Code Unloading
•
•
Code Sharing
Code Sharing
Operating System
Common Language Runtime
OSGi.NET
•
•
Service arrival
Service arrival
and departure
and departure
Key Technical Differences
Key Technical Differences
•
•
Technical differences between .NET and Java
Technical differences between .NET and Java
–
–
Class loading flexibility
Class loading flexibility
–
–
Loading / Unloading system
Loading / Unloading system
–
–
Code sharing
Code sharing
•
•
No direct way to map OSGi features onto .NET
No direct way to map OSGi features onto .NET
Alternative Implementation Approaches
Alternative Implementation Approaches
•
•
Four alternative approaches
Four alternative approaches
–
–
Mono
Mono
-
-
application domain
application domain
–
–
Multi
Multi
-
-
application domains
application domains
–
–
Hybrid alternative
Hybrid alternative
–
–
CLR modification
CLR modification
Mono
Mono
-
-
application domain
application domain
•
•
1 Bundle = 1 Assembly
1 Bundle = 1 Assembly
•
•
1 Application domain for
1 Application domain for
OSGi.NET
OSGi.NET
& Services
& Services
Operating System
Common Language Runtime
ASM 1 :
Provider
Loader
Application domain
ASM 2 :
Requester
ASM 3 :
Contract
Registry
Mono
Mono
-
-
Application Domain
Application Domain
•
•
Service invocation
Service invocation
……………………………
……………………………
..
..
Ok
Ok
•
•
Service arrival & departure
Service arrival & departure
……
……
..
..
……………
……………
.
.
Ok
Ok
•
•
Dynamic loading
Dynamic loading
…………
…………
.
.
……………………
……………………
Ok
Ok
•
•
Code sharing
Code sharing
…………………………………
…………………………………
...
...
No
No
–
–
All loaded code is shared inside an application domain
All loaded code is shared inside an application domain
–
–
Does not support private code
Does not support private code
•
•
Dynamic unloading
Dynamic unloading
……………………………
……………………………
.
.
No
No
Multi
Multi
-
-
Application Domain
Application Domain
•
•
1 bundle inside 1 application domain
1 bundle inside 1 application domain
•
•
OSGi.NET
OSGi.NET
in one application domain, bundles
in one application domain, bundles
reside in their own application domains
reside 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
Contract
Contract
Loader
Registry
Multi
Multi
-
-
Application Domain
Application Domain
•
•
Service invocation
Service invocation
……………………………
……………………………
Ok/No
Ok/No
–
–
Service invocation must use .NET
Service invocation must use .NET
Remoting
Remoting
–
–
Significant overhead
Significant overhead
•
•
Service arrival & departure
Service arrival & departure
…
…
..
..
………………
………………
.
.
Ok
Ok
•
•
Dynamic loading
Dynamic loading
……
……
.
.
…………………………
…………………………
Ok
Ok
–
–
Not fully transparent
Not fully transparent
•
•
Code sharing
Code sharing
…………………………………
…………………………………
...
...
No
No
–
–
All code is private
All code is private
•
•
Dynamic unloading
Dynamic unloading
……………………………
……………………………
.
.
Ok
Ok
Hybrid Solution
Hybrid Solution
•
•
Mix the 2 previous solutions
Mix the 2 previous solutions
–
–
Different services set inside application domain
Different services set inside application domain
–
–
Allow bindings inside & outside application domain
Allow bindings inside & outside application domain
–
–
Different range of services (local /
Different range of services (local /
“
“
remote
remote
”
”
services)
services)
–
–
Several registries (local and global)
Several registries (local and global)
•
•
Trade off for application designer
Trade off for application designer
–
–
How to group services into application domains
How to group services into application domains
•
•
Hypothesized, but not implemented
Hypothesized, but not implemented
Hybrid Solution
Hybrid Solution
AppDomain 2
Operating System
Common Language Runtime
AppDomain 1
AppDomain 0 : OSGi.NET
Remote Provider
Requester
Contract2
Contract1
Loader
Global Registry
Local Provider
Registry
Contract2
Registry
The Hybrid Solution
The Hybrid Solution
•
•
Service invocation
Service invocation
……………………………………
……………………………………
.
.
…
…
..
..
Ok
Ok
–
–
Choice between local service & remote service
Choice between local service & remote service
•
•
Service apparition & departure
Service apparition & departure
……………………
……………………
.
.
…
…
....
....
Ok
Ok
•
•
Dynamic loading
Dynamic loading
…………………………………
…………………………………
..
..
…
…
...
...
…
…
Ok
Ok
•
•
Code sharing
Code sharing
…………………………………………
…………………………………………
.
.
…
…
..
..
No
No
–
–
Inside application domain, all code is shared
Inside application domain, all code is shared
–
–
Outside application domain, no code sharing
Outside application domain, no code sharing
•
•
Dynamic unloading
Dynamic unloading
………………………………
………………………………
.
.
…
…
...
...
…
…
Ok
Ok
–
–
Unload an application domain = unload a set of
Unload an application domain = unload a set of
services
services
CLR Modification
CLR Modification
•
•
Introspection of an application domain
Introspection 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 1
Class 1
Class 2
Class 2
CLR Modification in ROTOR
CLR Modification in ROTOR
•
•
The approach :
The approach :
–
–
modification of the internal class loader
modification of the internal class loader
•
•
Enable private code sharing
Enable private code sharing
–
–
Add a garbage collector
Add a garbage collector
•
•
Enable unloading
Enable 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
Loader
Registry
Contract
CL
Provider-1
CLR Modification
CLR Modification
•
•
Service Invocation
Service Invocation
……………………………
……………………………
..
..
Ok
Ok
•
•
Service apparition & departure
Service apparition & departure
………………
………………
.
.
Ok
Ok
•
•
Dynamic Loading
Dynamic Loading
………………………………
………………………………
Ok
Ok
•
•
Code sharing
Code sharing
…………………………………
…………………………………
...
...
Ok
Ok
•
•
Dynamic Unloading
Dynamic Unloading
……………………………
……………………………
Ok
Ok
•
•
But it
But it
’
’
s no longer standard .NET and was too
s no longer standard .NET and was too
complex to implement within our time constraints
complex to implement within our time constraints
Alternatives Summary
Alternatives Summary
1234
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)
Conclusion
Conclusion
•
•
.NET
.NET
–
–
Well
Well
-
-
known virtual machine
known virtual machine
–
–
Distributed with Windows XP
Distributed with Windows XP
•
•
OSGi technology is Java
OSGi technology is Java
-
-
centric
centric
•
•
Tried to implement OSGi on .NET =>
Tried to implement OSGi on .NET =>
OSGi.Net
OSGi.Net
–
–
Four alternatives
Four alternatives
•
•
Is any alternative fully compliant with OSGi
Is any alternative fully compliant with OSGi
specification ?
specification ?
–
–
No
No
Perspectives
Perspectives
•
•
OSGi Release 4
OSGi Release 4
–
–
More difficult (more sophisticated class sharing &
More difficult (more sophisticated class sharing &
management)
management)
•
•
Waiting the next release of the .NET Framework
Waiting the next release of the .NET Framework
–
–
2007 ??
2007 ??
–
–
Not yet clear :
Not yet clear :
•
•
Unloading assemblies individually
Unloading assemblies individually
•
•
.NET
.NET
Remoting
Remoting
optimizations
optimizations
Questions ???
Questions ???
ROTOR
ROTOR
•
•
Shared Source CLI :
Shared Source CLI :
–
–
Distributed by Microsoft
Distributed by Microsoft
–
–
Very close with the official framework
Very close with the official framework
–
–
Contains VM, Compilers
Contains VM, Compilers
…
…
•
•
Some numbers
Some numbers
–
–
1.9 millions of LOC (C++, C#, MSIL, Assembler)
1.9 millions of LOC (C++, C#, MSIL, Assembler)
–
–
5900 sources files, 9700 files
5900 sources files, 9700 files
–
–
Kernel (
Kernel (
mscorlib
mscorlib
) : 867 classes in C++
) : 867 classes in C++
•
•
Discussions
Discussions
–
–
With the DOTNET
With the DOTNET
-
-
ROTOR mailing list
ROTOR mailing list
–
–
Microsoft newsgroups
Microsoft newsgroups
Multi
Multi
-
-
Domain Approach : Benchmark
Domain Approach : Benchmark
•
•
Method invocation time
Method invocation time
–
–
Calls intra
Calls intra
-
-
application domain
application domain
vs
vs
Calls inter
Calls inter
-
-
application
application
domain
domain
–
–
Processor 1
Processor 1
Ghz
Ghz
, RAM 768 Mo, Windows XP SP2,
, RAM 768 Mo, Windows XP SP2,
CLR 1.1
CLR 1.1
Void
Small Object
Medium Object
Huge Object
0
20
40
60
80
100
120
140
160
180
Temps des appels locaux
Temps en ms
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
Temps en ms
Intra Domain Calls
Inter Domains Calls
Time in ms
Time in ms
Enter the password to open this PDF file:
File name:
-
File size:
-
Title:
-
Author:
-
Subject:
-
Keywords:
-
Creation Date:
-
Modification Date:
-
Creator:
-
PDF Producer:
-
PDF Version:
-
Page Count:
-
Preparing document for printing…
0%
Comments 0
Log in to post a comment