Cloud Foundry: Design and Architecture
Derek Collison discusses the goals, the design premises and patterns employed in creating the architecture of Cloud Foundry, VMware’s open source PaaS, unveiling internal architectural details.
The content has been bookmarked!
There was an error bookmarking this content! Please retry.
Posted by Bienvenido David III on Jan 30, 2012
JBoss has released Byteman 2.0.0, an open source Java bytecode manipulation tool licensed under GNU LGPL 2.1. Byteman is a Java agent which helps testing, tracing, and monitoring code. It allows developers to change the operation of Java applications, either as it is loaded or during runtime. It works without the need to rewrite or recompile the application, and can even modify Java Platform classes like String, Thread, etc.
Here are what's new with Byteman 2.0.0.
Byteman uses a simple Event Condition Action (ECA) scripting language to specify where, when and how the target Java code should be transformed. Code execution continues once the injected code has been executed, although the injected code may throw an exception or force an early return. Here's an example of a simple Byteman script.
# script.btm
RULE trace main entry
CLASS App
METHOD main
AT ENTRY
IF true
DO traceln("entering main")
ENDRULE
Here we have a script that tells Byteman to print "entering main" at the start of the App.main() method. To enable Byteman in your application, and specify the script, add the Java agent JVM argument.
-javaagent:<BYTEMAN-DIR>\lib\byteman.jar=script:script.btm
Note you can also add Byteman on already running application using bminstall.sh. For more complex rules and code injection, you can use the built-in Byteman Rule Helpers, or you can create your own POJO as a plug-in.
Similar to Byteman, AOP is capable of instrumenting classes and inject code. With Byteman however, there is no need to create classes or compile code. You don't need 100% hindsight when you write your code, and can decide what code to inject at a later time. Byteman is also simpler to use and easier to change, especially for testing and ad hoc logging purposes.
To get started, you can download the Byteman binaries and specify it as a Java agent to your application. Note that Byteman requires JDK 6 or higher. Read the Byteman Programmer's Guide for in depth details. More information about this release can be found in the Byteman 2.0.0 release notes. You can also visit the official Byteman documentation and forum. Source code is available at GitHub.
Introducing SQLFire: a memory-optimized, high performance SQL database
Troubleshoot Java/.NET performance while getting full visibility in production
Early Access! Download JBoss Developer Studio 5.0 now, with packages for Mac, Windows or Linux!
App Server Evolution: REST, Cloud, and DevOps Support in Resin 4
Big Data, Cloud & Mobile: Navigate the New Development Reality with Resources from IBM
VMware vFabric SQLFire - Test drive the data management system with memory speed, horizontal scalability and a familiar SQL interface
I found Byteman extremely useful to test some of the edge cases of JGroups; tests that couldn't be written using only the public APIs. One example was to get thread timing off, in order to trigger an edge case that would produce an error.
The example involved 2 threads T1 and T2; T2 would be blocked and T1 would run first. T1 executed a part of the code, then it would be blocked, then T2 would execute, be blocked again, and T1 would continue.
I used sleeps to mimic this before, but the issue was that the JGroups test suite might run up to 20 tests in parallel, and thus a simple GC, or one of the threads getting enough CPU could get the timings off.
What I haven't used yet, but probably will is the capability to inject rules at runtime and remove them again later. This will be very handy when trying to dignose a running system.
Kudos to the Byteman team !
Bela
Thanks for posting about the Byteman project, I'd just like to correct a few details though.
Byteman does indeed include file and line number info into injected rule code but this is only one step in providing full debugger support. A couple of contributors are working on extending an IDE/debugger (specifically, Eclipse and IntelliJ Idea) to support both Byteman development and execution but neither of them is yet complete.
Byteman rules can be used to throw unexpected exceptions and errors in both application and JVM runtime code -- a very useful feature in both unit and integration tests. Indeed it can also be used to bypass method execution and return synthetic return values. However, code injected by Byteman is type-checked and type-safe, hence it will not break method contracts. So, you can only throw an exception declared by the method (or, of course, a RuntimeException or Error) and you can only return a value whose type matches the method return type.
Thanks Andrew. I've amended the text.
Derek Collison discusses the goals, the design premises and patterns employed in creating the architecture of Cloud Foundry, VMware’s open source PaaS, unveiling internal architectural details.
Andrew Watson talks about the work of the OMG, where CORBA is alive and well (hint: in your car), UML and UML Profiles vs. custom Modeling languages, DDS and other middleware, and much more.
Sohil Shah discusses creating iPhone and Android enterprise mobile applications based on cloud services using the open source platform OpenMobster.
Paul Sanford presents the transformations supported by data throughout its life cycle, and how that can be better done with Splunk, an engine for monitoring and analyzing machine-generated data.
A common “best practice” for unit tests is to only write a one assertion in each test. I intend to question this advice by showing that multiple assertions per test are both necessary and beneficial.
John Rauser presents the architectural and technological evolution of Amazon retail websites starting with 1994 and ending with adopting Amazon Web Services.
Michael Stal discusses system architecture quality, how to avoid architectural erosion, how to deal with refactoring, and design principles for architecture evolution.
Every developer has had to integrate with another system, API or component. Tis article provides strategies to handle the change and for he separating system boundaries.
3 comments
Watch Thread Reply