SlideShare una empresa de Scribd logo
1 de 39
Descargar para leer sin conexión
Kicking butt on concurrent
enterprise application with
           Scala




                  By
             Azrul MADISA
       Freelance Java Developer
        azrulhasni@gmail.com
Plat du jour
The concurrent
enterprise
The next billion users
Asynchronous
messaging
Enter Scala
Scala concurrency
Scala actors
Scala and Message
Driven Beans
The ever concurrent
      enterprise

Service A         Service A                 Service A



Service B
                                              Service B

              Service B
Service C
                                                        Service C
                          Service C

Service D                                 Service D
              Service D



Traditional           Modern          Web N.0 (large # of instances)
Commerce example
                                  Choose your
                                     things
Choose from      Choose from
things in the    things in the
    store            store
                                      Pay



  Queue up          Queue up
 (1 counter in   (Many counters
   the shop)       In the shop)
                                    Inventory


                                  Packaging
      Pay                         and delivery
                      Pay

Traditional        Hypermarkets   E-Commerce
Other sectors

Telco
   Switch board → Exchanges →
    NGN
Government
   Counter based → E-Government
Finance
   Counter → ATM → E-Banking
Others
   Millitary, logistics, media &
    content
The next billion users
                                                 Sum of Bandwidth:
                                                    Google, Twitter,
                                                    Facebook etc.

                                                 HPC (High performance
                                                 Computing)
                                                     Genomics, Animation

                                                 *Prise (Enterprise)
                                                      Cloud based, Saas,




* http://blogs.sun.com/Gregp/entry/a_word_or_two_on
Don't mean to scare ya
 but...
People are more network centric
   Every mobile device is a potential
     terminal to your services
   How many mobile devices are
     there?
      A couple of billion ?
People are not the only ones
  accessing your services
   [Please hum the X-Files theme
     song in your head right now]
=> Computing demand grows
 faster than Moore's law
   Also known as the red shift
One word to rule them all
...
One word to rule them all
...


                        i t y
                  i l
            a b
      a l
   S c
What technology will allow
     this?
Criteria
    Play well with current enterprise
      systems
      Play well on the JVM
   Fault tolerent
   Share-nothing philosophy
      Asynchronous messaging
      No side effect (Maybe functional)
   Easy to learn (tool support, language
     LAF)
   Performance – At least as good as
     current offerings
   Take advantage of multi-core tech.
Why asynchronous
         messaging important
E-commerce example:
                                               Verify
                                               stock
                User choose         Go to
 Start
                  products        checkout




                         No    Inform user    End

          Stock exist?

                               Take payment
                         Yes                  End
                                 from user
Why asynchronous
messaging important
Verify stock
  Millions of items
  Kicker... need to lock
    an item while
    reserving it
    To avoid 2 person
     buying the same
     thing
  Lengthy => Clients
   will run away
Why asynchronous
         messaging important
Simplified e-
                                                    End
  commerce
            User choose     Go to    Take payment
 Start
              products    checkout     from user
Why asynchronous
         messaging important
Simplified e-
                                                                       End
  commerce
                 User choose             Go to         Take payment
 Start
                  products             checkout          from user


                Fire another process


                                           Yes     Packaging +
                                                                      End
                                                    Shipment

 Verify stock              Stock exist?
                                                  Email to user –
                                                  item would be       End
                                           No
                                                     a bit late
Long running transaction

                 Short          OLTP
High volume
               processes


                             We somewhat know
                             how to do this




High volume
              Long running
               processes      ?
Long running transaction

   Client pay




Package an item




Ship to client's
   premise




 Client sign off
Long running transaction

   Client pay




Package an item
                                   Reimburse 80%
                                    Back to client
                   Exception!
Ship to client's
   premise
                                     Ship back to
                   Client cancel   vendor's premise

 Client sign off
Enter Scala
Created by Martin Odersky
Made is Swiss
    (no, it's not a knife nor a kind of cheese)
Run on Java JVM
    Java is king of the enterprise, running on JVM
       ensures adoption.
    Can use and inherit Java classes.
    Also runs on .Net CLR
Object oriented and functional at the same time
Statically typed with type inference
Recently used by Twitter on the back-end ...
  replacing that other you-know-which language
  ;)
Why not the other JVM
              languages
            JRuby, Jython , <The
              dynamic language of the
              day>
                  Duck typing? No thanks
            Clojure
                  Interesting but syntax is too
                    “lisp-y” - My personal
                    opinion
            Plain old Java
                  Are you kidding me?
Image from: http://www.travelblog.org/Europe/Netherlands/North-Holland/Volendam/blog-385862.html
Scala concurrency:
Immutable variables
Immutable variables
  Variable that cannot change its
   value
  Useful in concurrent apps
    State cannot be inconsistent
  Easily declare variables as
   immutable
  The “val” keyword automatically
   makes variable immutable
     val movie = new Movie(“Wolverine”)
Scala concurrency:
Immutable variables
Can Java do this?
  Java does this on String
  For other object:
    Tedious since Java don't have operator
     overloading
Scala concurrency: Easy
singleton
Often times, we need one single object per
  application
   E.g. Some utility class to access the
     database
Scala provide easy singleton:
     object MySingleton{
         //singleton's body
     }
The singleton's constructor is fully
  synchronized
Scala concurrency: Easy
singleton
Can we do this in Java
  Sure, but, again, it's tedious
  You have to create all the boilerplat
   code yourself
  Refer to the Gang Of Four book
Scala concurrency: Actors


Scala has actors
  … and no, they're not as
   bad as Paris Hilton
Scala concurrency: Actors
Actors
  Actors are objects
  Receive message asynchronously
  Reply with a Future
     Future = placeholder of future result
  Concurrency without threading
  Event-driven
  Unlike real-world actors, Scala actors
    are
     Cheap
     Totally ignored by politicians
Scala concurrency: Actors
Event driven architecture
  Unlike threads, actors are
   event-driven
    Only become alive when
     there are messages to be
     processed.
    Execute on a thread pool
    With message passing,
     number of locks are low
       Great for multicore processors
Scala concurrency: Actors

                  MainApp                                       End


               User choose          Go to       Take payment
Start
                 products         checkout        from user

           Fire another process

                                      Yes    Packaging +
                                                               End
                                              Shipment

Verify stock           Stock exist?
                                             Email to user –
                                             item would be      End
          Actor1                      No
                                                a bit late
Scala concurrency: Actors
case class MyMessage(myPaylod:String) //declare type of message
object Actor1 extends Actor {
 def act = {
    loop {
     react {
      case MyMessage(“Continue e-commerce process”) => //Manage Stock
    verification, Packaging and Delivery here
    … //closing curly braces
}
object MainApp extends Application {
 //Do your business logic here, once you get to Payment ...
 Actor1.start
 Actor1 ! MyMessage(“Continue”) //send message to actor Actor1
}
Scala concurrency: Actors
Can we do this in Java
  In plain old Java, thread can be used
  Thread can not be created in a Java
    EE container
  Have to use JMS
    OpenMQ
    ActiveMQ
    Message Driven Beans
    Message Driven Pojo with Spring
Scala concurrency:
Reliability
Short-comings of Scala messages
  They do not live in a transaction
  They cannot travel through a network
There are projects to address this
  short coming
  Scala OTP (Equivalent to Erlang OTP)
  ActiveObject
Another approach is to combine Scala
 and Java EE
Combining actors and
message driven beans
Scala Actors   Message driven bean




                       `
Combining actors and
message driven beans
Scala Actors                                 Message driven bean




                                                       `




               Bridging agent acting like a “worm-hole”                 d
               Between the Scala world and MDB                    el ate
                                                             re kr !
                                                                         !
                                                       ta r T used uck
                                                                   d
                                                    : S eing ek,
                                                 NG           e
                                             R NI is b t a g
                                                  y
                                         WA alog e no
                                          an ou'r
                                           If y
Combining actors and
     message driven beans
               Scala world                  JMS world

                                            Request
  Actor         javax.jms.MessageListener
                                            Queue




               WormholeActor
                                                        MDB




Scala object            Spring's Message
                           Driven Pojo
                                            Response
                                            Queue
Performance




Shamelessly plucked from
http://shootout.alioth.debian.org/u32q/benchmark.php?test=binarytrees&lang=all
Tools

Netbeans, Eclipse and IDEA plugin
My wish list

Scala actors working in XA
Developing EJB 3.1 in Scala
Seamlessly portable Scala apps to .Net
Better IDE support
Scala actors that can travel through a
  grid/cloud/network
   Pi-calculus
   Scala + SOA
An international Scala conf. in Malaysia
A magic flying talking pony err... car
Other interesting stuff

Lift
  Scala web framework based on
   actors
Scala books




Testing
  ScalaTest
References

The Scala official website
   scala-lang.org
Ted Neward's Scala For Busy Java
  Developer
Daniel Spiewak's Scala for Java
  Refugees
Debasish Ghosh's Scala Actors 101
Various blogs, forums, people (too
  many to name … )
End note
Scala is a sharp weapon to use in
  the coming “highly concurrent”
  age
Hope to get you excited over
  Scala
   Play with it
   Test it
   Use it
   Twitt/blog about it
Get something moving in
  Malaysia

Más contenido relacionado

Similar a Kicking Butt on Concurrent Enterprise Application with Scala

Subscription Systems and Recurring Payments in Drupal
Subscription Systems and Recurring Payments in DrupalSubscription Systems and Recurring Payments in Drupal
Subscription Systems and Recurring Payments in DrupalProdosh Banerjee
 
What does performance mean in the cloud
What does performance mean in the cloudWhat does performance mean in the cloud
What does performance mean in the cloudMichael Kopp
 
Goto meetup Stockholm - Let your microservices flow
Goto meetup Stockholm - Let your microservices flowGoto meetup Stockholm - Let your microservices flow
Goto meetup Stockholm - Let your microservices flowBernd Ruecker
 
TDC2017 | São Paulo - Trilha Arquitetura Java How we figured out we had a SRE...
TDC2017 | São Paulo - Trilha Arquitetura Java How we figured out we had a SRE...TDC2017 | São Paulo - Trilha Arquitetura Java How we figured out we had a SRE...
TDC2017 | São Paulo - Trilha Arquitetura Java How we figured out we had a SRE...tdc-globalcode
 
Long running processes in DDD
Long running processes in DDDLong running processes in DDD
Long running processes in DDDBernd Ruecker
 
An Introduction To Space Based Architecture
An Introduction To Space Based ArchitectureAn Introduction To Space Based Architecture
An Introduction To Space Based ArchitectureAmin Abbaspour
 
Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)Chris Richardson
 
Software Development Engineers Ireland
Software Development Engineers IrelandSoftware Development Engineers Ireland
Software Development Engineers IrelandSean O'Sullivan
 
Building Applications For The Cloud
Building Applications For The CloudBuilding Applications For The Cloud
Building Applications For The CloudToddy Mladenov
 
Peyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_futurePeyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_futureTakayuki Muranushi
 
Simon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSimon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSkills Matter
 
SignalR for ASP.NET Developers
SignalR for ASP.NET DevelopersSignalR for ASP.NET Developers
SignalR for ASP.NET DevelopersShivanand Arur
 
SaaS, Multi-Tenancy and Cloud Computing
SaaS, Multi-Tenancy and Cloud ComputingSaaS, Multi-Tenancy and Cloud Computing
SaaS, Multi-Tenancy and Cloud ComputingRainer Stropek
 
Event-Driven Architectures Done Right | Tim Berglund, Confluent
Event-Driven Architectures Done Right | Tim Berglund, ConfluentEvent-Driven Architectures Done Right | Tim Berglund, Confluent
Event-Driven Architectures Done Right | Tim Berglund, ConfluentHostedbyConfluent
 
Roundup presentation
Roundup presentationRoundup presentation
Roundup presentationmattgrommes
 
Jimwebber soa
Jimwebber soaJimwebber soa
Jimwebber soad0nn9n
 
2011 State of the Cloud: A Year's Worth of Innovation in 30 Minutes - Jinesh...
2011 State of the Cloud:  A Year's Worth of Innovation in 30 Minutes - Jinesh...2011 State of the Cloud:  A Year's Worth of Innovation in 30 Minutes - Jinesh...
2011 State of the Cloud: A Year's Worth of Innovation in 30 Minutes - Jinesh...Amazon Web Services
 
The FT Web App: Coding Responsively
The FT Web App: Coding ResponsivelyThe FT Web App: Coding Responsively
The FT Web App: Coding ResponsivelyC4Media
 
One millions users vs your web application mega testing cloud applications pr...
One millions users vs your web application mega testing cloud applications pr...One millions users vs your web application mega testing cloud applications pr...
One millions users vs your web application mega testing cloud applications pr...Justin Dorfman
 
Computing DevOps Summit, London, July 5, 2016
Computing DevOps Summit, London, July 5, 2016Computing DevOps Summit, London, July 5, 2016
Computing DevOps Summit, London, July 5, 2016Splunk
 

Similar a Kicking Butt on Concurrent Enterprise Application with Scala (20)

Subscription Systems and Recurring Payments in Drupal
Subscription Systems and Recurring Payments in DrupalSubscription Systems and Recurring Payments in Drupal
Subscription Systems and Recurring Payments in Drupal
 
What does performance mean in the cloud
What does performance mean in the cloudWhat does performance mean in the cloud
What does performance mean in the cloud
 
Goto meetup Stockholm - Let your microservices flow
Goto meetup Stockholm - Let your microservices flowGoto meetup Stockholm - Let your microservices flow
Goto meetup Stockholm - Let your microservices flow
 
TDC2017 | São Paulo - Trilha Arquitetura Java How we figured out we had a SRE...
TDC2017 | São Paulo - Trilha Arquitetura Java How we figured out we had a SRE...TDC2017 | São Paulo - Trilha Arquitetura Java How we figured out we had a SRE...
TDC2017 | São Paulo - Trilha Arquitetura Java How we figured out we had a SRE...
 
Long running processes in DDD
Long running processes in DDDLong running processes in DDD
Long running processes in DDD
 
An Introduction To Space Based Architecture
An Introduction To Space Based ArchitectureAn Introduction To Space Based Architecture
An Introduction To Space Based Architecture
 
Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)
 
Software Development Engineers Ireland
Software Development Engineers IrelandSoftware Development Engineers Ireland
Software Development Engineers Ireland
 
Building Applications For The Cloud
Building Applications For The CloudBuilding Applications For The Cloud
Building Applications For The Cloud
 
Peyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_futurePeyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_future
 
Simon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSimon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelism
 
SignalR for ASP.NET Developers
SignalR for ASP.NET DevelopersSignalR for ASP.NET Developers
SignalR for ASP.NET Developers
 
SaaS, Multi-Tenancy and Cloud Computing
SaaS, Multi-Tenancy and Cloud ComputingSaaS, Multi-Tenancy and Cloud Computing
SaaS, Multi-Tenancy and Cloud Computing
 
Event-Driven Architectures Done Right | Tim Berglund, Confluent
Event-Driven Architectures Done Right | Tim Berglund, ConfluentEvent-Driven Architectures Done Right | Tim Berglund, Confluent
Event-Driven Architectures Done Right | Tim Berglund, Confluent
 
Roundup presentation
Roundup presentationRoundup presentation
Roundup presentation
 
Jimwebber soa
Jimwebber soaJimwebber soa
Jimwebber soa
 
2011 State of the Cloud: A Year's Worth of Innovation in 30 Minutes - Jinesh...
2011 State of the Cloud:  A Year's Worth of Innovation in 30 Minutes - Jinesh...2011 State of the Cloud:  A Year's Worth of Innovation in 30 Minutes - Jinesh...
2011 State of the Cloud: A Year's Worth of Innovation in 30 Minutes - Jinesh...
 
The FT Web App: Coding Responsively
The FT Web App: Coding ResponsivelyThe FT Web App: Coding Responsively
The FT Web App: Coding Responsively
 
One millions users vs your web application mega testing cloud applications pr...
One millions users vs your web application mega testing cloud applications pr...One millions users vs your web application mega testing cloud applications pr...
One millions users vs your web application mega testing cloud applications pr...
 
Computing DevOps Summit, London, July 5, 2016
Computing DevOps Summit, London, July 5, 2016Computing DevOps Summit, London, July 5, 2016
Computing DevOps Summit, London, July 5, 2016
 

Más de Linuxmalaysia Malaysia

Big Data - Harisfazillah Jamel - Startup and Developer 4th Meetup 5th Novembe...
Big Data - Harisfazillah Jamel - Startup and Developer 4th Meetup 5th Novembe...Big Data - Harisfazillah Jamel - Startup and Developer 4th Meetup 5th Novembe...
Big Data - Harisfazillah Jamel - Startup and Developer 4th Meetup 5th Novembe...Linuxmalaysia Malaysia
 
Call For Speakers Malaysia Open Source Conference 2014 (MOSCMY 2014 - MOSCMY2...
Call For Speakers Malaysia Open Source Conference 2014 (MOSCMY 2014 - MOSCMY2...Call For Speakers Malaysia Open Source Conference 2014 (MOSCMY 2014 - MOSCMY2...
Call For Speakers Malaysia Open Source Conference 2014 (MOSCMY 2014 - MOSCMY2...Linuxmalaysia Malaysia
 
Malaysia Open Source Conference MOSCMY 2013 Itinerary And Streams MOSC2013 a...
Malaysia Open Source Conference MOSCMY 2013  Itinerary And Streams MOSC2013 a...Malaysia Open Source Conference MOSCMY 2013  Itinerary And Streams MOSC2013 a...
Malaysia Open Source Conference MOSCMY 2013 Itinerary And Streams MOSC2013 a...Linuxmalaysia Malaysia
 
MOSC2013 MOSCMY Brochure Malaysia Open Source Conference 2013
MOSC2013 MOSCMY Brochure Malaysia Open Source Conference 2013MOSC2013 MOSCMY Brochure Malaysia Open Source Conference 2013
MOSC2013 MOSCMY Brochure Malaysia Open Source Conference 2013Linuxmalaysia Malaysia
 
Brochure Malaysia Open Source Conference 2013 MOSCMY 2013 (MOSC2013) brochure
Brochure Malaysia Open Source Conference 2013 MOSCMY 2013 (MOSC2013) brochureBrochure Malaysia Open Source Conference 2013 MOSCMY 2013 (MOSC2013) brochure
Brochure Malaysia Open Source Conference 2013 MOSCMY 2013 (MOSC2013) brochureLinuxmalaysia Malaysia
 
Hala Tuju Kemahiran Keselamatan Komputer Dan Internet (ICT)
Hala Tuju Kemahiran Keselamatan Komputer Dan Internet (ICT)Hala Tuju Kemahiran Keselamatan Komputer Dan Internet (ICT)
Hala Tuju Kemahiran Keselamatan Komputer Dan Internet (ICT)Linuxmalaysia Malaysia
 
FOSSDAY@IIUM 2012 Cloud Presentation By LinuxMalaysia
FOSSDAY@IIUM 2012 Cloud Presentation By LinuxMalaysiaFOSSDAY@IIUM 2012 Cloud Presentation By LinuxMalaysia
FOSSDAY@IIUM 2012 Cloud Presentation By LinuxMalaysiaLinuxmalaysia Malaysia
 
Questionnaire For Establishment Of Board of Computing Professionals Malaysia ...
Questionnaire For Establishment Of Board of Computing Professionals Malaysia ...Questionnaire For Establishment Of Board of Computing Professionals Malaysia ...
Questionnaire For Establishment Of Board of Computing Professionals Malaysia ...Linuxmalaysia Malaysia
 
Sponsorship Prospectus Malaysia Open Source Conference 2012 (MOSC2012)
Sponsorship Prospectus Malaysia Open Source Conference 2012  (MOSC2012)Sponsorship Prospectus Malaysia Open Source Conference 2012  (MOSC2012)
Sponsorship Prospectus Malaysia Open Source Conference 2012 (MOSC2012)Linuxmalaysia Malaysia
 
OSS Community Forum Regarding Proposed BCPM2011 SWOT Slide
OSS Community Forum Regarding Proposed BCPM2011 SWOT SlideOSS Community Forum Regarding Proposed BCPM2011 SWOT Slide
OSS Community Forum Regarding Proposed BCPM2011 SWOT SlideLinuxmalaysia Malaysia
 
Introduction To ICT Security Audit OWASP Day Malaysia 2011
Introduction To ICT Security Audit OWASP Day Malaysia 2011Introduction To ICT Security Audit OWASP Day Malaysia 2011
Introduction To ICT Security Audit OWASP Day Malaysia 2011Linuxmalaysia Malaysia
 
Building Smart Phone Web Apps MOSC2010 Bikesh iTrain
Building Smart Phone Web Apps MOSC2010 Bikesh iTrainBuilding Smart Phone Web Apps MOSC2010 Bikesh iTrain
Building Smart Phone Web Apps MOSC2010 Bikesh iTrainLinuxmalaysia Malaysia
 
OSDC.my Master Plan For Malaysia Open Source Community
OSDC.my Master Plan For Malaysia Open Source CommunityOSDC.my Master Plan For Malaysia Open Source Community
OSDC.my Master Plan For Malaysia Open Source CommunityLinuxmalaysia Malaysia
 
33853955 bikesh-beginning-smart-phone-web-development
33853955 bikesh-beginning-smart-phone-web-development33853955 bikesh-beginning-smart-phone-web-development
33853955 bikesh-beginning-smart-phone-web-developmentLinuxmalaysia Malaysia
 
Open Source Tools for Creating Mashups with Government Datasets MOSC2010
Open Source Tools for Creating Mashups with Government Datasets MOSC2010Open Source Tools for Creating Mashups with Government Datasets MOSC2010
Open Source Tools for Creating Mashups with Government Datasets MOSC2010Linuxmalaysia Malaysia
 
DNS solution trumps cloud computing competition
DNS solution trumps cloud computing competitionDNS solution trumps cloud computing competition
DNS solution trumps cloud computing competitionLinuxmalaysia Malaysia
 
Brochure MSC Malaysia Open Source Conference 2010 (MSC MOSC2010)
Brochure MSC Malaysia Open Source Conference 2010 (MSC MOSC2010)Brochure MSC Malaysia Open Source Conference 2010 (MSC MOSC2010)
Brochure MSC Malaysia Open Source Conference 2010 (MSC MOSC2010)Linuxmalaysia Malaysia
 
Benchmarking On Web Server For Budget 2008 Day
Benchmarking On  Web  Server For  Budget 2008  DayBenchmarking On  Web  Server For  Budget 2008  Day
Benchmarking On Web Server For Budget 2008 DayLinuxmalaysia Malaysia
 

Más de Linuxmalaysia Malaysia (20)

Big Data - Harisfazillah Jamel - Startup and Developer 4th Meetup 5th Novembe...
Big Data - Harisfazillah Jamel - Startup and Developer 4th Meetup 5th Novembe...Big Data - Harisfazillah Jamel - Startup and Developer 4th Meetup 5th Novembe...
Big Data - Harisfazillah Jamel - Startup and Developer 4th Meetup 5th Novembe...
 
Call For Speakers Malaysia Open Source Conference 2014 (MOSCMY 2014 - MOSCMY2...
Call For Speakers Malaysia Open Source Conference 2014 (MOSCMY 2014 - MOSCMY2...Call For Speakers Malaysia Open Source Conference 2014 (MOSCMY 2014 - MOSCMY2...
Call For Speakers Malaysia Open Source Conference 2014 (MOSCMY 2014 - MOSCMY2...
 
Malaysia Open Source Conference MOSCMY 2013 Itinerary And Streams MOSC2013 a...
Malaysia Open Source Conference MOSCMY 2013  Itinerary And Streams MOSC2013 a...Malaysia Open Source Conference MOSCMY 2013  Itinerary And Streams MOSC2013 a...
Malaysia Open Source Conference MOSCMY 2013 Itinerary And Streams MOSC2013 a...
 
MOSC2013 MOSCMY Brochure Malaysia Open Source Conference 2013
MOSC2013 MOSCMY Brochure Malaysia Open Source Conference 2013MOSC2013 MOSCMY Brochure Malaysia Open Source Conference 2013
MOSC2013 MOSCMY Brochure Malaysia Open Source Conference 2013
 
Brochure Malaysia Open Source Conference 2013 MOSCMY 2013 (MOSC2013) brochure
Brochure Malaysia Open Source Conference 2013 MOSCMY 2013 (MOSC2013) brochureBrochure Malaysia Open Source Conference 2013 MOSCMY 2013 (MOSC2013) brochure
Brochure Malaysia Open Source Conference 2013 MOSCMY 2013 (MOSC2013) brochure
 
Hala Tuju Kemahiran Keselamatan Komputer Dan Internet (ICT)
Hala Tuju Kemahiran Keselamatan Komputer Dan Internet (ICT)Hala Tuju Kemahiran Keselamatan Komputer Dan Internet (ICT)
Hala Tuju Kemahiran Keselamatan Komputer Dan Internet (ICT)
 
FOSSDAY@IIUM 2012 Cloud Presentation By LinuxMalaysia
FOSSDAY@IIUM 2012 Cloud Presentation By LinuxMalaysiaFOSSDAY@IIUM 2012 Cloud Presentation By LinuxMalaysia
FOSSDAY@IIUM 2012 Cloud Presentation By LinuxMalaysia
 
Questionnaire For Establishment Of Board of Computing Professionals Malaysia ...
Questionnaire For Establishment Of Board of Computing Professionals Malaysia ...Questionnaire For Establishment Of Board of Computing Professionals Malaysia ...
Questionnaire For Establishment Of Board of Computing Professionals Malaysia ...
 
Sponsorship Prospectus Malaysia Open Source Conference 2012 (MOSC2012)
Sponsorship Prospectus Malaysia Open Source Conference 2012  (MOSC2012)Sponsorship Prospectus Malaysia Open Source Conference 2012  (MOSC2012)
Sponsorship Prospectus Malaysia Open Source Conference 2012 (MOSC2012)
 
OSS Community Forum Regarding Proposed BCPM2011 SWOT Slide
OSS Community Forum Regarding Proposed BCPM2011 SWOT SlideOSS Community Forum Regarding Proposed BCPM2011 SWOT Slide
OSS Community Forum Regarding Proposed BCPM2011 SWOT Slide
 
Introduction To ICT Security Audit OWASP Day Malaysia 2011
Introduction To ICT Security Audit OWASP Day Malaysia 2011Introduction To ICT Security Audit OWASP Day Malaysia 2011
Introduction To ICT Security Audit OWASP Day Malaysia 2011
 
Building Smart Phone Web Apps MOSC2010 Bikesh iTrain
Building Smart Phone Web Apps MOSC2010 Bikesh iTrainBuilding Smart Phone Web Apps MOSC2010 Bikesh iTrain
Building Smart Phone Web Apps MOSC2010 Bikesh iTrain
 
OSDC.my Master Plan For Malaysia Open Source Community
OSDC.my Master Plan For Malaysia Open Source CommunityOSDC.my Master Plan For Malaysia Open Source Community
OSDC.my Master Plan For Malaysia Open Source Community
 
33853955 bikesh-beginning-smart-phone-web-development
33853955 bikesh-beginning-smart-phone-web-development33853955 bikesh-beginning-smart-phone-web-development
33853955 bikesh-beginning-smart-phone-web-development
 
Open Source Tools for Creating Mashups with Government Datasets MOSC2010
Open Source Tools for Creating Mashups with Government Datasets MOSC2010Open Source Tools for Creating Mashups with Government Datasets MOSC2010
Open Source Tools for Creating Mashups with Government Datasets MOSC2010
 
DNS solution trumps cloud computing competition
DNS solution trumps cloud computing competitionDNS solution trumps cloud computing competition
DNS solution trumps cloud computing competition
 
Brochure MSC Malaysia Open Source Conference 2010 (MSC MOSC2010)
Brochure MSC Malaysia Open Source Conference 2010 (MSC MOSC2010)Brochure MSC Malaysia Open Source Conference 2010 (MSC MOSC2010)
Brochure MSC Malaysia Open Source Conference 2010 (MSC MOSC2010)
 
Benchmarking On Web Server For Budget 2008 Day
Benchmarking On  Web  Server For  Budget 2008  DayBenchmarking On  Web  Server For  Budget 2008  Day
Benchmarking On Web Server For Budget 2008 Day
 
Sesuaikan Masa Sempena 2010
Sesuaikan Masa Sempena 2010Sesuaikan Masa Sempena 2010
Sesuaikan Masa Sempena 2010
 
OSS Community In Malaysia 2009 List
OSS Community In Malaysia 2009 ListOSS Community In Malaysia 2009 List
OSS Community In Malaysia 2009 List
 

Último

Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 

Último (20)

Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 

Kicking Butt on Concurrent Enterprise Application with Scala

  • 1. Kicking butt on concurrent enterprise application with Scala By Azrul MADISA Freelance Java Developer azrulhasni@gmail.com
  • 2. Plat du jour The concurrent enterprise The next billion users Asynchronous messaging Enter Scala Scala concurrency Scala actors Scala and Message Driven Beans
  • 3. The ever concurrent enterprise Service A Service A Service A Service B Service B Service B Service C Service C Service C Service D Service D Service D Traditional Modern Web N.0 (large # of instances)
  • 4. Commerce example Choose your things Choose from Choose from things in the things in the store store Pay Queue up Queue up (1 counter in (Many counters the shop) In the shop) Inventory Packaging Pay and delivery Pay Traditional Hypermarkets E-Commerce
  • 5. Other sectors Telco Switch board → Exchanges → NGN Government Counter based → E-Government Finance Counter → ATM → E-Banking Others Millitary, logistics, media & content
  • 6. The next billion users Sum of Bandwidth: Google, Twitter, Facebook etc. HPC (High performance Computing) Genomics, Animation *Prise (Enterprise) Cloud based, Saas, * http://blogs.sun.com/Gregp/entry/a_word_or_two_on
  • 7. Don't mean to scare ya but... People are more network centric Every mobile device is a potential terminal to your services How many mobile devices are there? A couple of billion ? People are not the only ones accessing your services [Please hum the X-Files theme song in your head right now] => Computing demand grows faster than Moore's law Also known as the red shift
  • 8. One word to rule them all ...
  • 9. One word to rule them all ... i t y i l a b a l S c
  • 10. What technology will allow this? Criteria Play well with current enterprise systems Play well on the JVM Fault tolerent Share-nothing philosophy Asynchronous messaging No side effect (Maybe functional) Easy to learn (tool support, language LAF) Performance – At least as good as current offerings Take advantage of multi-core tech.
  • 11. Why asynchronous messaging important E-commerce example: Verify stock User choose Go to Start products checkout No Inform user End Stock exist? Take payment Yes End from user
  • 12. Why asynchronous messaging important Verify stock Millions of items Kicker... need to lock an item while reserving it To avoid 2 person buying the same thing Lengthy => Clients will run away
  • 13. Why asynchronous messaging important Simplified e- End commerce User choose Go to Take payment Start products checkout from user
  • 14. Why asynchronous messaging important Simplified e- End commerce User choose Go to Take payment Start products checkout from user Fire another process Yes Packaging + End Shipment Verify stock Stock exist? Email to user – item would be End No a bit late
  • 15. Long running transaction Short OLTP High volume processes We somewhat know how to do this High volume Long running processes ?
  • 16. Long running transaction Client pay Package an item Ship to client's premise Client sign off
  • 17. Long running transaction Client pay Package an item Reimburse 80% Back to client Exception! Ship to client's premise Ship back to Client cancel vendor's premise Client sign off
  • 18. Enter Scala Created by Martin Odersky Made is Swiss (no, it's not a knife nor a kind of cheese) Run on Java JVM Java is king of the enterprise, running on JVM ensures adoption. Can use and inherit Java classes. Also runs on .Net CLR Object oriented and functional at the same time Statically typed with type inference Recently used by Twitter on the back-end ... replacing that other you-know-which language ;)
  • 19. Why not the other JVM languages JRuby, Jython , <The dynamic language of the day> Duck typing? No thanks Clojure Interesting but syntax is too “lisp-y” - My personal opinion Plain old Java Are you kidding me? Image from: http://www.travelblog.org/Europe/Netherlands/North-Holland/Volendam/blog-385862.html
  • 20. Scala concurrency: Immutable variables Immutable variables Variable that cannot change its value Useful in concurrent apps State cannot be inconsistent Easily declare variables as immutable The “val” keyword automatically makes variable immutable val movie = new Movie(“Wolverine”)
  • 21. Scala concurrency: Immutable variables Can Java do this? Java does this on String For other object: Tedious since Java don't have operator overloading
  • 22. Scala concurrency: Easy singleton Often times, we need one single object per application E.g. Some utility class to access the database Scala provide easy singleton: object MySingleton{ //singleton's body } The singleton's constructor is fully synchronized
  • 23. Scala concurrency: Easy singleton Can we do this in Java Sure, but, again, it's tedious You have to create all the boilerplat code yourself Refer to the Gang Of Four book
  • 24. Scala concurrency: Actors Scala has actors … and no, they're not as bad as Paris Hilton
  • 25. Scala concurrency: Actors Actors Actors are objects Receive message asynchronously Reply with a Future Future = placeholder of future result Concurrency without threading Event-driven Unlike real-world actors, Scala actors are Cheap Totally ignored by politicians
  • 26. Scala concurrency: Actors Event driven architecture Unlike threads, actors are event-driven Only become alive when there are messages to be processed. Execute on a thread pool With message passing, number of locks are low Great for multicore processors
  • 27. Scala concurrency: Actors MainApp End User choose Go to Take payment Start products checkout from user Fire another process Yes Packaging + End Shipment Verify stock Stock exist? Email to user – item would be End Actor1 No a bit late
  • 28. Scala concurrency: Actors case class MyMessage(myPaylod:String) //declare type of message object Actor1 extends Actor { def act = { loop { react { case MyMessage(“Continue e-commerce process”) => //Manage Stock verification, Packaging and Delivery here … //closing curly braces } object MainApp extends Application { //Do your business logic here, once you get to Payment ... Actor1.start Actor1 ! MyMessage(“Continue”) //send message to actor Actor1 }
  • 29. Scala concurrency: Actors Can we do this in Java In plain old Java, thread can be used Thread can not be created in a Java EE container Have to use JMS OpenMQ ActiveMQ Message Driven Beans Message Driven Pojo with Spring
  • 30. Scala concurrency: Reliability Short-comings of Scala messages They do not live in a transaction They cannot travel through a network There are projects to address this short coming Scala OTP (Equivalent to Erlang OTP) ActiveObject Another approach is to combine Scala and Java EE
  • 31. Combining actors and message driven beans Scala Actors Message driven bean `
  • 32. Combining actors and message driven beans Scala Actors Message driven bean ` Bridging agent acting like a “worm-hole” d Between the Scala world and MDB el ate re kr ! ! ta r T used uck d : S eing ek, NG e R NI is b t a g y WA alog e no an ou'r If y
  • 33. Combining actors and message driven beans Scala world JMS world Request Actor javax.jms.MessageListener Queue WormholeActor MDB Scala object Spring's Message Driven Pojo Response Queue
  • 36. My wish list Scala actors working in XA Developing EJB 3.1 in Scala Seamlessly portable Scala apps to .Net Better IDE support Scala actors that can travel through a grid/cloud/network Pi-calculus Scala + SOA An international Scala conf. in Malaysia A magic flying talking pony err... car
  • 37. Other interesting stuff Lift Scala web framework based on actors Scala books Testing ScalaTest
  • 38. References The Scala official website scala-lang.org Ted Neward's Scala For Busy Java Developer Daniel Spiewak's Scala for Java Refugees Debasish Ghosh's Scala Actors 101 Various blogs, forums, people (too many to name … )
  • 39. End note Scala is a sharp weapon to use in the coming “highly concurrent” age Hope to get you excited over Scala Play with it Test it Use it Twitt/blog about it Get something moving in Malaysia