Skip to content

gobio/jape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Application Performance Explained

Why use Jape?

Jape can help you to understand and optimize the performance of complicated processes visualizing execution time and dependencies between process's stages. In modern Java application which uses asynchronous computing with tools like CompletableFuture, parallel streams or RXJava it's sometimes tricky to see which parts are executed sequentially and which parallelly and what stages should be optimized to optimize the whole process.

Example

Following examples show how delegating steps to separate threads can increase concurrency.

Sequential stream:

Observable.range(0,5)
          .map(this::map)
          .filter(this::filter)
          .scan(this::sum)
          .subscribe(this::subscribe);

Sequential stream

Concurrent stream:

Observable.range(0,5)
          .observeOn(Schedulers.computation())
          .map(this::map)
          .filter(this::filter)
          .scan(this::sum)
          .subscribe(this::subscribe);

Concurrent stream

Concurrent stream 2

Observable.range(0,5)
          .observeOn(Schedulers.computation())
          .map(this::map)
          .observeOn(Schedulers.computation())
          .filter(this::filter)
          .scan(this::sum)
          .subscribe(this::subscribe);

Concurrent stream 2

Concurrent stream 3

Observable.range(0,5)
          .observeOn(Schedulers.computation())
          .map(this::map)
          .observeOn(Schedulers.computation())
          .filter(this::filter)
          .observeOn(Schedulers.computation())
          .scan(this::sum)
          .subscribe(this::subscribe);

Concurrent stream 2

Concurrent stream 4

Observable.range(0,5)
          .observeOn(Schedulers.computation())
          .map(this::map)
          .observeOn(Schedulers.computation())
          .filter(this::filter)
          .observeOn(Schedulers.computation())
          .scan(this::sum)
          .observeOn(Schedulers.computation())
          .subscribe(this::subscribe);

Concurrent stream 2

Source

Running example

Clone or download the example project and execute command:
Linux

./gradlew run

Windows

gradlew.bat run

The program will start example computation and open url http://localhost:5005 in a browser. Wait a while to finish some computation and click selected trace to show the chart: Example Live example

Warning

The project is at the early experimental stage and should not be used in a production environment.

About

Java Application Performance Explained

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages