1 / 38

An Introduction to IBM WebSphere sMash

An Introduction to IBM WebSphere sMash. Robin Fernandes - PHP Runtime for WebSphere sMash robinf@php.net / robin_fernandes@uk.ibm.com. Why WebSphere sMash?. Developers want to: Build Web apps quickly . Re-use and combine existing apps simply .

evalynf
Télécharger la présentation

An Introduction to IBM WebSphere sMash

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An Introduction to IBM WebSphere sMash Robin Fernandes - PHP Runtime for WebSphere sMash robinf@php.net / robin_fernandes@uk.ibm.com Introduction to IBM WebSphere sMash

  2. Why WebSphere sMash? • Developers want to: • Build Web apps quickly. • Re-use and combine existing apps simply. • Take an agile approach to Web app development. • Quick reaction to change • Cost-effective development • Ease of deployment  Speed, Simplicity, Agility • Developers are adopting: • Dynamic scripting languages for application logic (PHP, Ruby, Groovy…) • Low barrier to entry, high productivity • Enable “Search, copy and paste” style development • REST, JSON to tie Web Apps together • Simple, works well with Ajax

  3. What is WebSphere sMash? A complete platform for developing, assembling and executing agile Web 2.0 apps quickly and simply. • Started in 2007 as Project Zero, a community driven incubator project • http://projectzero.org • Released as WebSphere sMash product in May 2008 • Built from the ground up with a focus on Speed, Simplicity & Agility

  4. JVM Web server Application Code Language runtimes WebSphere sMash: Speed (time to value) • Quick to get started • Download from projectzero.org and unzip • Scripting languages: low barrier to entry • PHP, Groovy • Convention over configuration • Common tasks shouldn't require configuration • Application-centric runtime • Write the app, run it, and it’s ready for use. • No need for a separate application server. sMash application:

  5. WebSphere sMash: Simplicity • Small number of new concepts in sMash • Scripts, Events, Global Context • Focus on RESTful architecture • Build applications around CRUDL events on Resources • Tooling to encourage use of REST • Trivial deployment • To move an app to another machine: zip, copy, run

  6. WebSphere sMash: Agility • A clean runtime for your applications • Each app has its own JVM process  isolation • Short-lived processes (“ZSO” manages startup on 1st request, recycle) • App ready for use in <1s, footprint is ~380KB idle and ~28MB running • Modular architecture • Features and pre-built services downloaded as required • Core modules about ~5MB (includes HTTP stack, Groovy support) • Browser-based tooling for client and server-side development • Includes visual tools to simplify Web app interoperation

  7. RTE DE Versions of WebSphere sMash

  8. Demo: • WebSphere sMash on http://projectzero.org • The AppBuilder • Hello World on WebSphere sMash • Modules

  9. Available Modules • There are 65+ modules available currently • Modules provide function in many categories • Data Formats (JSON, ATOM, RSS, XML) • Data Access • Resource Modelling • Security / Content Filtering • Activity Flows • Services • Amazon ECS, Flickr, Weather, etc • Utilities (such as HTML parsing) • Management Tools • Development Tooling • Reliable Transport Engine for Messaging Interactions

  10. Key Concept: Events • WebSphere sMash initiates well-known system events. • Developers define the application behaviour by implementing event handlers. • Conventions define where sMash will search for event handlers. • Events are stateless. State information is stored in the Global Context.

  11. Key Concept: The Global Context • It’s a map of data! • Language-agnostic • Used for passing data between events, for storing application state • Zones define the life time of the data: Non-persistent Spot the zget() & zput() calls in the next demo! Persistent http://www.projectzero.org/sMash/1.0.x/docs/zero.devguide.doc/zero.core/GlobalContextReference.html

  12. Key Concept: RESTful Architecture • What is REST? • Application is defined in terms of Resources • Resources are exposed as URIs • Behaviour is governed by HTTP requests on these URIs • Standard HTTP methods specify the action to carry out on the resource (POST / GET / PUT / DELETE ) • Requests are stateless: HTTP requests contains enough information to carry out the desired operation in full  Scalable, because the request can be handled by any back-end system • http://myshop.com/customer • GET: Returns a list of customers • POST: Creates a customer record • http://myshop.com/customer/homer • GET: Retrieves customer record ‘homer’ • PUT: Updates record ‘homer’ • DELETE: Deletes record ‘homer’

  13. Demo: a RESTful Pastebin • What’s a Pastebin? see http://pastebin.com • Website for sharing snippets of text, usually code; get a URL for that snippet. • Useful for collaborating, heavily used by PHP community (help finding bugs in code, submitting patches etc…) • We’ll use the “Zero Resource Model” • The RESTful resource we’ll use in this demo: “snippet” : { “title”: string, “lang” : string, “body” : string }

  14. JVM The PHP Engine • Why PHP in sMash? • Gartner predict that within 5 years, 60% of 5.5 million PHP developers will work in corporate IT (up from 13% of 3M today) • Vast amounts of PHP code available for “search/copy/paste” development • Wikipedia, Facebook, Flickr, Yahoo, phpBB, SugarCRM… • http://php.net: the de facto standard PHP engine • Open Source, written in C • Vast array of extension functions (String, image manipulation, IMAP…) • Why write a PHP engine in Java for sMash? • Dynamic Languages + JVM =♥ • Excellent interop with sMash’s Java APIs – and with any Java code!

  15. PHP Engine Architecture Debug API (DBGp) Runtime • Runtime for PHP 5 scripts • Implemented in Java, runs on any Java 5+ VM • Parse script to intermediate representation • Compile to bytecode • JVM executes the bytecode • Bytecode calls back into runtime to access PHP language elements, which are represented as Java objects • Extensibility via XAPI • XAPI-C for C extensions from php.net • XAPI-J for new Java extensions, native libraries invoked over JNI and Project Zero interface • Extension language choice opaque to PHP script • Debug via DBGp using Eclipse with PDT PHP Scripts sMash CLI SAPI - J PHP Engine AST Parser P8 Runtime Variables Compiler opcodes Stack Interpreter Resources .class Classes Objects Cache XAPI-J XAPI-C Java Extensions C Extensions Native code sMash Extensions

  16. PHP Language Support • Core PHP extensions supported • Currently supports a subset of PHP extensions • The goal is maximum re-use of existing PHP scripts and applications. phpBB SugarCRM

  17. Two levels of PHP/Java Integration • <?php • $date = new Java("java.util.Date", 70, 9, 4); • var_dump($date->toString()); • $map = new Java("java.util.HashMap"); • $map->put("title", "Java Bridge!"); • $map->put("when", $date); • echo$map->get("when")->toString()."\n"; • echo$map->get("title")."\n"; • $array = array(1,2,3,4,5); • $map->put("stuff", $array); // PHP array to Java Map • var_dump($map->get("stuff"))."\n"; • ?> • Direct use of Java objects in PHP Code:

  18. Two levels of PHP/Java Integration • Use annotations and a thin wrapper around your Java code • Allows definition of PHP specific attributes that could not be represented in plain Java code. @XAPIClass("ArrayObject") publicfinalclassArrayObjectDescriptor { @XAPIMethod(name = "setIteratorClass") @XAPIForbidStaticCalls @XAPIArguments( PassSemantics = { XAPIPassSemantics.ByValue }, MandatoryArguments = 1, MaximumArguments = 2, DefaultValues = { "ArrayIterator" } ) publicstaticvoid setIteratorClass(RuntimeContextStack runtime, intargsPassed){ //...

  19. Show PHP interacting with a custom Java asset Demo: PHP / Java Integration PHP Code PHP Runtime in sMash Your Java code AST Generator! JVM

  20. Features we didn’t cover • Client Programming with the Dojo Framework • Assemble Tooling • Data APIs • Security • Eclipse-based tooling • REST to SOAP adapter • Reliable Messaging • Error Handling • Logging, Tracing, Debugging • …

  21. Summary • WebSphere sMash: • Runtime optimized for quickly and easily creating situational applications • Low barrier to entry • Browser-based tooling for client and server side development • Convention over configuration • Focus on REST • Java/PHP/Groovy interoperability • All, including PHP, run on the JVM

  22. http://projectzero.org Community site for users and developers • Content • Documentation and User Guides • Design documents and Roadmaps • Demos and Samples • Forum for interactive discussion • Help and Feedback for questions from users • Developer Alerts to notify users of new features and breaking changes • Development discussion • 3554 Posts on 828 Topics to date • Blogs • Development blog with interesting commentary, demos, and opinion • News blog for project announcements • Binary Downloads (500,000 and counting…) • Bug Tracking System (Bugzilla) • Source code (Subversion)

  23. Links • http://projectzero.org • Search for WebSphere sMash onhttp://www.ibm.com/developerworks • Thanks to the following for presentation material: • Colin Thorne, Stuart Hayton, Don Boulia, Rob Nicholson, Roland Barcia, Steve Ims Robin Fernandes robinf@php.net robin_fernandes@uk.ibm.com

  24. Spares

  25. JVM Web server Application Code Language runtimes Runtime characteristics: Application-centric Runtime • WebSphere sMash is an application-centric runtime: • The application is the server - you don't deploy it on an app server. • Each app has its own JVM process • Isolation: one failing app won't bring down the others • JVM Processes are managed by the Zero Socket Opener (ZSO) • Short-lived processes: recycle after idle period • JVM starts up on first request • Application available for service in under 1 second • Idle application: 380K in memory • Running application: 28MB sMash application:

  26. WebSphere sMash Overview • Application-centric • Modular • Encourages REST • Event Driven • State stored in Global Context App components script Events REST Browser Global Context script HTTP server flow Local repository Package Manager Remote repository code Zero Application Java Virtual Machine

  27. Runtime characteristics: Modular Architecture • ~5MB initial download • Includes core framework, runtime, HTTP stack and Groovy support • Applications define dependent packages using Apache Ivy • Dependencies are resolved as needed from remote repositories • Downloaded packages are shared between applications running on the same machine • The package manager also deals with updates and versioning

  28. The Future • Browser-based tooling improvements: • Tooling for iWidget creation • Integrated debugger (breakpoints, stack inspection etc…) • Further JVM improvements: • Improvements for running dynamic languages on the JVM • Improvements to start-up time and footprint • Further integration with other IBM products • E.g. for scalability • More modules available from the repository • PHP runtime enhancements

  29. Community Driven Commercial Development Project Zero: the development community for WebSphere sMash Commercial development using a transparent development process Enabled via an external web site providing: • A focal point for all sMash development activities • Expose the IBM development process to the external developer community • All design decisions are discussed and communicated via external forums • Registered users can post comments and feedback to the forums • Frictionless download of latest code and documentation • Registration not required for binary downloads • Latest builds immediately available to developers • Source code can be viewed by registered users http://www.projectzero.org

  30. Building a Rich User Interface • Dojo is the preferred Ajax/JavaScript toolkit for Zero • Open source toolkit to simplify rich web applications • http://www.dojotoolkit.org • v1.0 released on 5th November 2007 • Addresses key problem with browser compatibility • Dijit library provides rich set of user interface widgets • Accessibility built in • Internationalised • Theme 100% customisable • DojoX adds experimental and specialised extensions • Wire, XML, cryptography, network

  31. Input controls – buttons, combo box, sliders, text areas • Layout – accordion, split/stack containers, tabs • Command – button, menu, toolbar • User assistance and feedback – progress bar, tooltip, dialog • Advanced editing and display – editor, tree, colour palette

  32. Dojo Core Widget Set (Dijit) Accessibility • ARIA specification implemented in all widgets • Fully keyboard accessible in Firefox and Internet Explorer • Screen reader accessible in Firefox • Works in operating system high-contrast mode (system colours) • Works with images off (regular <img> tags) • Currently only auto-detected in Firefox • Must be in high-contrast mode for image-off support in Internet Explorer. • More information available from: http://www.w3.org/WAI/intro/aria

  33. Reliable Messaging between sMash applications 34

  34. Reliable Messaging between sMash and ESB 35

  35. Meerkat

  36. ZSL Case Study http://tinyurl.com/55fb2r “The Enteprise 2.0 SocNet that we built with WebSphere sMash is helping our developer community worldwide to collaborate and contribute their ideas to develop innovative business solutions and also address our Knowledge and Digital Assets Management issues effectively.” - Shiv Kumar, executive vice president, ZSL • Benefits: • Web application built in 3½ weeks • 67% reduction in time-to-market for developing Web 2.0 assets • 90% less time to implement best-of-breed programs • Out-of-the-box functionality vs. 2½ days to install comparable software “That extraordinary speed to market comes courtesy of WebSphere sMash. The IBM software makes best-of-breed, open source tools easy to integrate. “We’re using phpBB, a popular Internet forum package, to structure our forums,” says Noel. “We picked that up in a couple of hours. We spent a couple of days incorporating Apache Lucene, which is the best search engine on the Web and it runs on Java. Had we not used WebSphere sMash, we would have spent a month incorporating these tools into our SocNet.”

  37. Legal Notices • Java and all Java-based trademarks and logos are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. • Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. • Intel and Pentium are trademarks or registered trademark of Intel Corporation or its subsidiaries in the United States and other countries. • UNIX is a registered trademark of The Open Group in the United States and other countries. • Linux is a trademark of Linus Torvalds in the United States, other countries, or both. • Other company, product, or service names may be trademarks or service marks of others.

More Related