dynamic software updates: a vm-centric approach · 2015. 9. 14. · update data check update safety...
TRANSCRIPT
![Page 1: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/1.jpg)
Dynamic Software Updates:
A VM-centric Approach
Suriya Subramanian1 Michael Hicks2
Kathryn S. McKinley1
1Department of Computer SciencesThe University of Texas at Austin
2Department of Computer ScienceUniversity of Maryland, College Park
June 16, 2009ACM SIGPLAN PLDI 2009
![Page 2: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/2.jpg)
Motivation
Software applications change all the time
Deployed systems must be updated with bug fixes, new features
Updating typically involves: stop, apply patch, restart
Not desirable
Safety concernsRevenue lossInconvenience
Slide 2
![Page 3: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/3.jpg)
Dynamic software updating
Code
bytecodes machinecodes
Heap
Stacks
Version 1 process
Code
bytecodes machinecodes
Version 2 process
Heap
Update Code
Update Data
Check update safety
Stacks
Update Stacks
Slide 3
![Page 4: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/4.jpg)
Dynamic updating systems
Special-purpose architectures, application-specific solutions exist
General-purpose solutions gaining strength
K42, Ksplice for OS updatesPolus, Ginseng for C applications
Not for managed languages
Slide 4
![Page 5: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/5.jpg)
Our solution
Jvolve - a Java Virtual Machine with DSU support
Key insight: Extend existing VM services
No DSU-related overhead during normal execution
Support updates to real world applications
Dynamic software updating in managed languages can be achieved ina safe, flexible and efficient manner by naturally extending existingVM services.
DSU support should be a standard feature of future VMs.
Slide 5
![Page 6: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/6.jpg)
Jvolve - System overview
Foo.javaFoo.java
Foo.java
Foo.javaFoo.java
Foo.java
current version
new version
UpdatePreparation
Tool
JvolveTransformers.java
changed methods
Code
bytecodes machinecodes
Heap
Stacks
... ... ...
changed classes}
Slide 6
![Page 7: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/7.jpg)
Supported updates
Changes within the body of a method
public static void main(String args[]) {System.out.println("Hello, World.");
+ System.out.println("Hello again, World.");}
Class signature updates
Add, remove, change the type signature of fields and methods
public class Line {- private final Point2D p1;+ private final Point3D p1;
...}
Signature updates require an object transformer function
Slide 7
![Page 8: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/8.jpg)
Check for update safety
Code
bytecodes machinecodes
Heap
Stacks
Version 1 process
Code
bytecodes machinecodes
Version 2 process
Heap
Update Code
Update Data
Check update safety
Stacks
Update Stacks
Slide 8
![Page 9: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/9.jpg)
Safe point for the update
Update must be atomic
Updates happen at “safe points”
Safe points are VM yield points, and restrict what methods canbe on stack
Extend the thread scheduler to suspend all application threads
If any stack has a restricted method, delay the update
Slide 9
![Page 10: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/10.jpg)
Restricted methods
(1) Methods changed by the update
(2) Methods identified by the user as unsafe based on semanticinformation about the application
Install return barriers that trigger DSU upon unsafe method’s return
(3) Methods whose bytecode is unchanged, but compiledrepresentation is changed by the update
Offsets of fields and methods hard-coded in machine codeInlined callees may have changed
Utilize on-stack replacement to recompile base-compiled methods
Slide 10
![Page 11: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/11.jpg)
Restricted methods
(1) Methods changed by the update
(2) Methods identified by the user as unsafe based on semanticinformation about the application
Install return barriers that trigger DSU upon unsafe method’s return
(3) Methods whose bytecode is unchanged, but compiledrepresentation is changed by the update
Offsets of fields and methods hard-coded in machine codeInlined callees may have changed
Utilize on-stack replacement to recompile base-compiled methods
Slide 10
![Page 12: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/12.jpg)
Reaching a safe point
Modified method
Group 3 method
c()
d()
e()
Activation Stack
Growsdownwards
b()
a()
main()
Install a return barrier for d(). Wait till it returns. On-stack replacenew machine code for c().
Slide 11
![Page 13: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/13.jpg)
Update code
Code
bytecodes machinecodes
Heap
Stacks
Version 1 process
Code
bytecodes machinecodes
Version 2 process
Heap
Update Code
Update Data
Check update safety
Stacks
Update Stacks
Slide 12
![Page 14: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/14.jpg)
Update code
Modify class loader to recognize new versions of classes
Install new versions of classes and methods
Rely on Just-in-time Compiler to compile new versions ofmethods on demand
Extend On-stack replacement to update active methods
Slide 13
![Page 15: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/15.jpg)
Update data
Code
bytecodes machinecodes
Heap
Stacks
Version 1 process
Code
bytecodes machinecodes
Version 2 process
Heap
Update Code
Update Data
Check update safety
Stacks
Update Stacks
Slide 14
![Page 16: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/16.jpg)
Example of an update (JavaEmailServer)
public class User {private final String username, domain, password;
- private String[] forwardAddresses;+ private EmailAddress[] forwardAddresses;
public User(...) {...}public String[] getForwardedAddresses() {...}
public void setForwardedAddresses(String[] f) {...}
}
public class ConfigurationManager {private User loadUser(...) {
...User user = new User(...);String[] f = ...;
user.setForwardedAddresses(f);return user;
}}
Slide 15
![Page 17: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/17.jpg)
Example of an update (JavaEmailServer)
public class User {private final String username, domain, password;
- private String[] forwardAddresses;+ private EmailAddress[] forwardAddresses;
public User(...) {...}- public String[] getForwardedAddresses() {...}+ public EmailAddress[] getForwardedAddresses() {...}- public void setForwardedAddresses(String[] f) {...}+ public void setForwardedAddresses(EmailAddress[] f) {...}
}
public class ConfigurationManager {private User loadUser(...) {
...User user = new User(...);
- String[] f = ...;+ EmailAddress[] f = ...;
user.setForwardedAddresses(f);return user;
}}
Slide 16
![Page 18: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/18.jpg)
Example of an update (JavaEmailServer)
public class v131_User {private final String username, domain, password;private String[] forwardAddresses;
}public class JvolveTransformers {...public static void jvolveClass(User unused) {}public static void jvolveObject(User to, v131_User from) {
to.username = from.username;to.domain = from.domain;to.password = from.password;// to.forwardAddresses = null;int len = from.forwardAddresses.length;to.forwardAddresses = new EmailAddress[len];for (int i = 0; i < len; i++) {to.forwardAddresses[i] =
new EmailAddress(from.forwardAddresses[i]);}}}
Slide 17
Default transformer copiesold fields, initializes newones to null
Stub generated by UPTfor the old version
![Page 19: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/19.jpg)
Example of an update (JavaEmailServer)
public class v131_User {private final String username, domain, password;private String[] forwardAddresses;
}public class JvolveTransformers {...public static void jvolveClass(User unused) {}public static void jvolveObject(User to, v131_User from) {
to.username = from.username;to.domain = from.domain;to.password = from.password;// to.forwardAddresses = null;int len = from.forwardAddresses.length;to.forwardAddresses = new EmailAddress[len];for (int i = 0; i < len; i++) {to.forwardAddresses[i] =
new EmailAddress(from.forwardAddresses[i]);}}}
Slide 17
Stub generated by UPTfor the old version
![Page 20: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/20.jpg)
Transforming objects in the GC
a b c
a b cBefore
After
Happens in two stepsGarbage collector creates an additional empty copy for updatedobjects
Walk through and transform all these objects
Slide 18
![Page 21: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/21.jpg)
Jvolve GC
To space (old version objects)
To space
From space
a b c
Slide 19
![Page 22: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/22.jpg)
Jvolve GC
To space (old version objects)
To space
From space
a b c
a b c
PointerForwarding pointer
Slide 19
![Page 23: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/23.jpg)
Jvolve GC
To space (old version objects)
To space
From space
a b c
a b c
PointerForwarding pointer
jvolveObject(Node to,old_Node from) {
to.data = from.data;to.next = from.next;if (to.next != null) {to.next.prev = to;
}
}
Slide 19
![Page 24: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/24.jpg)
Jvolve GC
To space (old version objects)
To space
From space
b
a b c
a b c
PointerForwarding pointer
jvolveObject(Node to,old_Node from) {
to.data = from.data;to.next = from.next;if (to.next != null) {to.next.prev = to;
}
}
Slide 19
![Page 25: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/25.jpg)
Jvolve GC
To space (old version objects)
To space
From space
b
a b c
a b c
PointerForwarding pointer
jvolveObject(Node to,old_Node from) {
to.data = from.data;to.next = from.next;if (to.next != null) {to.next.prev = to;
}
}
Slide 19
![Page 26: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/26.jpg)
Jvolve GC
To space (old version objects)
To space
From space
b
a b c
a b c
PointerForwarding pointer
jvolveObject(Node to,old_Node from) {
to.data = from.data;to.next = from.next;if (to.next != null) {to.next.prev = to;
}
}
Slide 19
![Page 27: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/27.jpg)
Jvolve GC
To space (old version objects)
To space
From space
b
a b c
a b c
PointerForwarding pointer
Slide 19
![Page 28: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/28.jpg)
Jvolve GC
To space (old version objects)
To space
From space
a b c
a b c
a b c
PointerForwarding pointer
Slide 19
![Page 29: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/29.jpg)
Jvolve GC
To space (old version objects)
To space
From space
a b c
Slide 19
![Page 30: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/30.jpg)
Application Experience
Jetty webserver
11 versions, 5.1.0 through 5.1.10, 1.5 years45 KLOC
JavaEmailServer
10 versions, 1.2.1 through 1.4, 2 years4 KLOC
CrossFTP server
4 versions, 1.05 through 1.08, more than a year18 KLOC
Slide 20
![Page 31: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/31.jpg)
What works
Support 20 of 22 updates
13 updates change class signature by adding new fields
Several updates require On-stack replacement support
Two versions update an infinite loop, postponing the updateindefinitely
Slide 21
![Page 32: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/32.jpg)
Jvolve performance
No overhead during steady-state execution
Jvolve Jvolve (updated)
Configuration
121.0
121.1
121.2
121.3
121.4
121.5
Thr
ough
put (
MB
/s)
Throughput
0.30
0.32
0.34
0.36
0.38
Latency (m
s)
Latency
Slide 22
![Page 33: Dynamic Software Updates: A VM-centric Approach · 2015. 9. 14. · Update Data Check update safety Update Stacks Slide 8. Safe point for the update ... and restrict what methods](https://reader033.vdocuments.us/reader033/viewer/2022060818/60971636202f71191d05a57b/html5/thumbnails/33.jpg)
Conclusion
Jvolve, a Java VM with support for Dynamic SoftwareUpdating
Most-featured, best-performing DSU system for Java
Naturally extends existing VM services
Supports about two years worth of updates
Dynamic software updating in managed languages can be achieved ina safe, flexible and efficient manner.
Source code and other information:http://www.cs.utexas.edu/~suriya/jvolve
Slide 23