Reactive Programming - Efficient Server Applications

Reactive Programming - Efficient Server Applications

The second part of the presentation for "Hack Your Career" event organized by SAP Hybris company at Silesian University of Technology in Gliwice, Poland

Slides are supportive for further live coding.
Code samples from this part the presentation are available at:
- https://github.com/pwittchen/reactive-client-server
- https://github.com/pwittchen/java-flow-experiments

E8bb35e5d8c868e7dffcd9859248d6f1?s=128

Piotr Wittchen

November 08, 2017
Tweet

Transcript

  1. INTERNAL Piotr Wittchen, Arkadiusz Galwas, SAP Hybris Reactive Programming Efficient

    Server Applications
  2. Let’s plan an application

  3. 3 INTERNAL © 2017 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Basic application flow Client Data Acquisition Reading data from sensors. Client Sending Data Sending data from the Client to the Server over HTTP protocol. Server Data Handling Handling incoming data received from the Client. Server Data Processing Processing handled data and logging them.
  4. 4 INTERNAL © 2017 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Flow of the data streams inside the application 1 Stream of Sensor Events Data acquired on a m obile device 2 Stream of HTTP Requests Data sent from the client to the server 3 Stream of HTTP Responses Data received by the server Continuous stream of the data without breaking a chain
  5. 5 INTERNAL © 2017 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Technologies we are going to use • Server ◦ Gradle ◦ Java 9 ◦ RxJava 2 ◦ Vert.x ▪ Core ▪ Rx ◦ Logback • Client ◦ Gradle ◦ Android ◦ Java 7 ◦ Retrolambda ◦ RxJava 2 ◦ RxAndroid ◦ OkHttp 3 ◦ ReactiveSensors Side note This is just a simple demo with the only one endpoint. For more endpoints it’s better to use Vertx-web on the server and Retrofit on the client.
  6. Let’s make an application!

  7. 7 INTERNAL © 2017 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Source code of this project can be found at: https://github.com/pwittchen/reactive-client-server/
  8. Optimizing CPU usage with RxJava

  9. 9 INTERNAL © 2017 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Optimizing CPU usage Core Core thread thread thread thread If we are not using all available cores efficiently, we’re wasting resources and applications are getting slow. CPU
  10. None
  11. 11 INTERNAL © 2017 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Source code of this project can be found at: https://github.com/pwittchen/java-flow-experiments
  12. Thank you Contact information: Piotr Wittchen, Arkadiusz Galwas piotr.wittchen@sap.com, arkadiusz.galwas@sap.com

    Software Developers SAP Hybris