Creating polyglot and scalable applications on the jvm using Vert.x
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Creating polyglot and scalable applications on the jvm using Vert.x

on

  • 2,220 views

In this presentation I show the basic vert.x options for creating polyglot applications that scale on the JVM. Later on the live presentation will also be published. It will be in Dutch though.

In this presentation I show the basic vert.x options for creating polyglot applications that scale on the JVM. Later on the live presentation will also be published. It will be in Dutch though.

Statistics

Views

Total Views
2,220
Views on SlideShare
2,193
Embed Views
27

Actions

Likes
3
Downloads
41
Comments
0

4 Embeds 27

https://twitter.com 22
http://www.slashdocs.com 2
https://www.linkedin.com 2
https://si0.twimg.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Creating polyglot and scalable applications on the jvm using Vert.x Presentation Transcript

  • 1. Creating Polyglot and Scalable Applications on the JVM with Vert.x Jettro Coenradie @gridshoredinsdag 30 oktober 12The butterfly represents the lightweight scalable architecture
  • 2. http://maps.google.comdinsdag 30 oktober 12Does this territory look familiar?
  • 3. http://maps.google.comdinsdag 30 oktober 12Tripoint of countries: The netherlands, Germany and BelgiumPeople here speak multiple languages and are therefore Polyglot
  • 4. Polyglot applications http://maps.google.comdinsdag 30 oktober 12- Polyglot applications is not about writing them in Dutch, German and French- Discuss combining multiple jvm languages in one application
  • 5. JDBC, Reflection JIT Compiler, Collections framework Hotspot JVM, JNDI Reg Exp, NIO, XML parsing Generics, Varargs, enums Scripting Language Support Dynamic languages on JVM 1 1.1 1.2 1.3 1.4 5 6 7 1996 1997 1998 2000 2002 2004 2006 2011dinsdag 30 oktober 12The history of the JVM and the introduction of Dynamic languages on the JVM and theimportance for a polyglot application on the JVM.
  • 6. Polyglot applications on the JVMdinsdag 30 oktober 12Now the JVM supports creating Polyglot applications.
  • 7. C10K Problem http://www.tumblr.com/tagged/rockconcert?before=1346635427dinsdag 30 oktober 12C10k problemThe crowd becomes to big for your platform
  • 8. http://en.wikipedia.org/wiki/C10k_problemdinsdag 30 oktober 12Wikipedia page about the C10K problem showing the main characteristics of availablesolutions: event-driven, non-blocking and asynchronous
  • 9. Scalable applications on the JVMdinsdag 30 oktober 12Some of the mentioned solutions run on the JVM and the JVM is the right tools for the jobwhen you want to create non-blocking, event-driven, asynchronous applications.
  • 10. Vert.x ✦Netty ✦JRuby ✦Groovy ✦Rhino ✦Jython ✦Hazelcast @timfoxdinsdag 30 oktober 12Introduction of vertx, the creator and the main technologies used.
  • 11. Polyglot application platform JavaScriptdinsdag 30 oktober 12The available languages for vert.x and the languages for which support is being created.
  • 12. Scalable: Blocking to non-blockingdinsdag 30 oktober 12Blocking has the risk that the CPU is doing nothing while a thread is waiting for inputNon-blocking: can use the CPU more effectively if there is something to do, it does not fallasleep
  • 13. Easily Concurrentdinsdag 30 oktober 12- We can use the multiple cores of a machine within one JVM- Easy concurrency due to thread bound modules and verticles => No Locking- Synchronous calling of a request handler. Therefore no concurrency issues.
  • 14. Vert.x Components Event Loop 1 Background Pool Verticle Verticle Worker Worker Core Services Event Bus Module Module Module Event Loop 2dinsdag 30 oktober 12Go through all the different components of Vert.x
  • 15. Vert.x Core Event Loop 1 Background Pool • Must be implemented by all languages Verticle Verticle Worker Worker Core • Core services must be called direct Services • Example Services Event Bus • TCP/SSL, HTTP/HTTPS, WebSockets, Module Module Module Logging, SockJS and more Event Loop 2dinsdag 30 oktober 12Core services must be called directly, no need for sending messages
  • 16. Verticle Background Pool • Unit of deployment in Vert.x Event Loop 1 Verticle Verticle Worker Worker Core • Can contain other scripts Services • Can contain libraries Event Bus • Can start other verticles Module Module Module Event Loop 2dinsdag 30 oktober 12- Demo basic verticle
  • 17. Module Background Pool • Modules communicate using messages Event Loop 1 Verticle Verticle Worker Worker Core • A public module repository Services • https://github.com/vert-x/vertx-mods/ Event Bus tree/gh-pages/mods Module Module Module Event Loop 2dinsdag 30 oktober 12
  • 18. Worker Verticle Background Pool • For tasks that require blocking Event Loop 1 Verticle Verticle Worker Worker Core • For tasks that take a lot of computation Services • Uses thread of the background pool Event Bus • They are never executed by more than one Module Module Module thread Event Loop 2dinsdag 30 oktober 12
  • 19. Verticle or Module Background Pool • Verticle is easy to use Event Loop 1 Verticle Verticle Worker Worker Core • Verticle needs to be configured with its Services classpath when running Event Bus • A module is a package of vert.x stuff complete with dependencies. Module Module Module Event Loop 2dinsdag 30 oktober 12
  • 20. Communicating between modules • Send messages over the Event bus • Vert.x will automatically convert messages between modules Java JsonObject Groovy Map Ruby Hash JavaScript Object Python Hashdinsdag 30 oktober 12Messages can contain contain raw types, but JSON is recommended to be used forinformation sending using messages.
  • 21. Threads Event loop • Amount equals number of cores • Verticles/modules are assigned to an event loop Background Pool • A thread pool for worker verticles • Actions can block or take longer CPU timedinsdag 30 oktober 12
  • 22. Demo: Office events Event Loop 1 Background Pool Backup App Core Services Event Bus Mongo Invitations Website Notifications Persistor Event Loop 2 Event Loop 1 https://github.com/jettro/vertx-samples/tree/master/office-eventsdinsdag 30 oktober 12The office events demo is available on github. It is used to show modules, verticles andworker verticles in different languages.
  • 23. Module layout • Module naming: prefix.<name>-v<version> • mod.json • scripts or classes • lib/ - libraries required by the moduledinsdag 30 oktober 12mod.json is the configuration for the module containing the main item, worker or not andsome other options.
  • 24. Configuration • Pass configuration when deploying a verticle or module • Use a json object • json is used according the language as discussed beforedinsdag 30 oktober 12
  • 25. Events • Publish/Subscribe • Peer-to-Peer • Replying to messages • Distributed event-busdinsdag 30 oktober 12More info about event usage in Vert.x
  • 26. Logging • Default uses java utils logging • Use other logging framework: log4j for example • <home>/bin/vertx • DEFAULT_JVM_OPTS="-Dorg.vertx.logger-delegate-factory-class- name=org.vertx.java.core.logging.impl.Log4jLogDelegateFactory" • Add the library to the vertx lib folder • Create a log4j.properties filedinsdag 30 oktober 12
  • 27. There is more • Shared data • Embedded mode • Clustered modedinsdag 30 oktober 12
  • 28. More info Vert.x Tim Fox @timfox Jettro http://vertx.io Downloads and Coenradie documentation http://groups.google.com/group/vertx @jettroCoenradie https://github.com/jettro/vertx- samples/ office-events @gridshore http://www.linkedin.com/in/jettro http://www.gridshore.nl http://www.trifork.nl https://github.com/jettro/dinsdag 30 oktober 12
  • 29. Questions ?? Rock ?? Concert by Rod Stewart with 3.500.000 visitorsdinsdag 30 oktober 12Now we can scale our rock concert to around 3.5 million users.