This document discusses Java 8 parallel streams and lambda expressions. It begins with an introduction to the author and their expertise in performance tuning. It then provides examples of using lambda expressions to simplify code by removing inner classes. Finally, it discusses using parallel streams to process collections of data concurrently, and when parallel streams may or may not provide benefits over imperative single-threaded code.
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
HotSpot promises to do the "right" thing for us by identifying our hot code and compiling "just-in-time", but how does HotSpot make those decisions?
This presentation aims to detail how HotSpot makes those decisions and how it corrects its mistakes through a series of demos that you run yourself.
Leveraging Completable Futures to handle your query results AsynchrhonouslyDavid Gómez García
The document discusses leveraging CompletableFutures to handle asynchronous query results in Java. It begins with an overview of concurrency vs parallelism and tools in Java for concurrency. It then covers using ExecutorServices and Futures to run tasks asynchronously before introducing CompletableFutures, which allow fluent chaining and composition of dependent asynchronous tasks. Examples are provided of using CompletableFutures to run database queries asynchronously and maximize performance. Considerations for using CompletableFutures in APIs are also discussed.
The document discusses various techniques for improving Java application performance, including:
1. Using tools like JVisualVM and JConsole to analyze performance bottlenecks and determine where to focus optimization efforts.
2. Customizing the Java runtime environment through JVM options and garbage collection settings.
3. Following programming tips like using object scopes and final modifiers efficiently, choosing appropriate collection types, leveraging concurrency constructs properly.
4. Reading further on techniques involving Java I/O, NIO, locks, and lock-free programming.
How Green are Java Best Coding Practices? - GreenDays @ Rennes - 2014-07-01Jérôme Rocheteau
This work investigates if best coding practices in Java can stand for eco-design rules as they deal with software performance. It focuses on how validating such an hypothesis for consumed energy, spent execution time and peak allocated memory. It leads to this silent feedback: no need to carry on many measures.
The document discusses CompletableFuture in Java. It begins with an introduction to java.util.Future and its limitations. It then discusses how CompletableFuture allows asynchronous and parallel operations through callbacks and chaining of tasks. This improves performance over serial execution. It provides examples of CompletableFuture methods like supplyAsync, thenApply, thenCombine, and allOf. Finally, it discusses how CompletableFuture can be used to build powerful and scalable libraries.
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
HotSpot promises to do the "right" thing for us by identifying our hot code and compiling "just-in-time", but how does HotSpot make those decisions?
This presentation aims to detail how HotSpot makes those decisions and how it corrects its mistakes through a series of demos that you run yourself.
Leveraging Completable Futures to handle your query results AsynchrhonouslyDavid Gómez García
The document discusses leveraging CompletableFutures to handle asynchronous query results in Java. It begins with an overview of concurrency vs parallelism and tools in Java for concurrency. It then covers using ExecutorServices and Futures to run tasks asynchronously before introducing CompletableFutures, which allow fluent chaining and composition of dependent asynchronous tasks. Examples are provided of using CompletableFutures to run database queries asynchronously and maximize performance. Considerations for using CompletableFutures in APIs are also discussed.
The document discusses various techniques for improving Java application performance, including:
1. Using tools like JVisualVM and JConsole to analyze performance bottlenecks and determine where to focus optimization efforts.
2. Customizing the Java runtime environment through JVM options and garbage collection settings.
3. Following programming tips like using object scopes and final modifiers efficiently, choosing appropriate collection types, leveraging concurrency constructs properly.
4. Reading further on techniques involving Java I/O, NIO, locks, and lock-free programming.
How Green are Java Best Coding Practices? - GreenDays @ Rennes - 2014-07-01Jérôme Rocheteau
This work investigates if best coding practices in Java can stand for eco-design rules as they deal with software performance. It focuses on how validating such an hypothesis for consumed energy, spent execution time and peak allocated memory. It leads to this silent feedback: no need to carry on many measures.
The document discusses CompletableFuture in Java. It begins with an introduction to java.util.Future and its limitations. It then discusses how CompletableFuture allows asynchronous and parallel operations through callbacks and chaining of tasks. This improves performance over serial execution. It provides examples of CompletableFuture methods like supplyAsync, thenApply, thenCombine, and allOf. Finally, it discusses how CompletableFuture can be used to build powerful and scalable libraries.
Lambda expressions were introduced in JDK 8 as a simpler way to represent behaviour. This session looks at usage details and performance compared to anonymous inner classes before diving into Lambda calculus
Proxy Deep Dive JUG Saxony Day 2015-10-02Sven Ruppert
Ein wenig über Proxy´s. Wer mehr Hintergrundinfos dazu haben möchte, empfehle ich das Buch von Dr. Kabutz und mir :
http://www.amazon.de/Dynamic-Proxies-Dr-Heinz-Kabutz/dp/3868021531/ref=asap_bc?ie=UTF8
This document discusses building an "Internet of Trains" project using LEGO trains controlled over WiFi. It describes connecting Raspberry Pis to LEGO trains using infrared transmitters and switches. An Android/web application allows controlling the trains remotely. Challenges included coordinating the distributed system, which the authors addressed using Scala and Akka actors for remote communication between devices. Performance tests showed remote actors had faster response times than HTTP for this real-time control application.
A dive into the world of Lambda expressions in JDK 8, covering the fundamental ideas, some gotchas and a discussion of performance. Finally, just how far can you take Lambdas in Java?
The document discusses Java 8 streams and stream performance. It provides background on streams and why they were introduced in Java 8. It discusses sequential and parallel streams, how to visualize them, and practical benefits. It covers microbenchmarking and a case study comparing a sequential grep implementation to a parallelized version. Key points are that streams can improve readability but performance must be tested, parallelism helps if the workload is large enough to outweigh overhead, and stream sources need to be splittable for parallelism.
SPLAT is a Python tool that generates unit tests lazily and automatically. It uses lazy instantiation to only generate test data for variables that are actively used, improving performance. SPLAT works by wrapping classes and functions with proxy metaclasses that generate test inputs and assertions dynamically during execution based on the bytecode. An evaluation of SPLAT found that it was able to achieve 100% code coverage for sample Python packages and modules in under 500 iterations on average. Future work could improve the tool's sophistication in handling different programming constructs and optimize performance further.
Receiver types allow functions to be declared that operate on a specific receiver type. This includes function types with receivers, which define interfaces for functions, and function literals with receivers, which implement those interfaces. Examples show how Bundle.apply uses a function literal with Bundle as the receiver to configure a Bundle instance. This is a common pattern in Kotlin for building objects through fluent APIs.
The document provides an overview of key differences between Python and Scala. Some key points summarized:
1. Python is a dynamically typed, interpreted language while Scala is statically typed and compiles to bytecode. Scala supports both object-oriented and functional programming paradigms.
2. Scala has features like case classes, traits, and pattern matching that Python lacks. Scala also has features like type parameters, implicit conversions, and tail call optimization that Python does not support natively.
3. Common data structures like lists and maps are implemented differently between the languages - Scala uses immutable Lists while Python uses mutable lists. Scala also has features like lazy vals.
4. Control
The document discusses Alteryx SDKs and APIs. It describes how Alteryx is based on a separation of the Designer GUI and Engine. This allows for various SDKs to create custom tools and functions. The SDKs include ones for custom functions, custom tools with different frontend (HTML, WinForms) and backend (C++, C#, Python) options. It provides examples of XML and C++ based custom functions. It also outlines the processes for creating custom tools, including the interfaces for GUI plugins and engine plugins.
JAX-RS and CDI Bike the (Reactive) BridgeJosé Paumard
This session explains how JAX-RS and CDI became reactive capable in Java EE 8. We put some new features of JAX-RS 2.1 and CDI 2.0 into perspective and show some reactive patterns to improve your application. Add Java 8 CompletionStage to the mix and this API trio becomes your best bet to easily go reactive without leaving the Java EE train.
Tene’s new workshop on ‘StructuredArray – Contained Objects in the Heap’ will examine the key implementation options for deriving speed and memory layout benefits of ObjectLayout’s StructuredArray constructs in future JVM versions, including simple options for adding contained object layout capability to the various existing Garbage Collection mechanisms used by various JVMs.
This document discusses scaling R to large datasets using Scala and Akka. It describes how R has limitations for parallelism and handling large data in memory. The author demonstrates reading a large CSV file of 100 million doubles (1.7GB) in parallel using Scala, Akka actors and Rserve. Producer and Worker actors divide the file and sum parts in Rserve. This allows scaling R computations to large data beyond a single machine's memory. Potential applications mentioned include optimization, distributed linear algebra, machine learning and statistics.
Ibis: Seamless Transition Between Pandas and Apache SparkDatabricks
Pandas is the de facto standard (single-node) Data Frame implementation in Python. However, as data grows larger, pandas no longer works very well due to performance reasons.
This document provides an overview of lambda expressions and streams in Java. It covers lambda syntax, method references, the Stream class and common stream operations like map, filter and reduce. Examples are given to find the highest test score or longest line of text from a stream. The document recommends getting started with the provided LambdasHOL project to complete exercises on lambda and stream operations.
Java Performance: Speedup your application with hardware countersSergey Kuksenko
A modern CPU looks under the cover to understand what performance. What about hardware for Java application performance? Let's understand Performance Monitoring Unit works, Hardware Counters & using them to speeding up Java apps.
The document discusses using aspect oriented programming (AOP) in Python to design APIs. It describes how AOP can help separate concerns like security, logging, and serialization into distinct aspects to avoid scattering code across multiple functions. Decorators are proposed as a way to implement aspects for a bioenergy application API. Specific decorator aspects are presented for security, statistics, serialization, and dispatching API calls to core functions. The implementation applies the aspects as decorators to API functions to cleanly separate the concerns.
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...Thomas Wuerthinger
Multi-language runtimes providing simultaneously high performance for several programming languages still remain an illusion. Industrial-strength managed language runtimes are built with a focus on one language (e.g., Java or C#). Other languages may compile to the bytecode formats of those managed language runtimes. However, the performance characteristics of the bytecode generation approach are often lagging behind compared to language runtimes specialized for a specific language. The performance of JavaScript is for example still orders of magnitude better on specialized runtimes (e.g., V8 or SpiderMonkey).
We present a solution to this problem by providing guest languages with a new way of interfacing with the host runtime. The semantics of the guest language is communicated to the host runtime not via generating bytecodes, but via an interpreter written in the host language. This gives guest languages a simple way to express the semantics of their operations including language-specific mechanisms for collecting profiling feedback. The efficient machine code is derived from the interpreter via automatic partial evaluation. The main components reused from the underlying runtime are the compiler and the garbage collector. They are both agnostic to the executed guest languages.
The host compiler derives the optimized machine code for hot parts of the guest language application via partial evaluation of the guest language interpreter. The interpreter definition can guide the host compiler to generate deoptimization points, i.e., exits from the compiled code. This allows guest language operations to use speculations: An operation could for example speculate that the type of an incoming parameter is constant. Furthermore, the guest language interpreter can use global assumptions about the system state that are registered with the compiled code. Finally, part of the interpreter's code can be excluded from the partial evaluation and remain shared across the system. This is useful for avoiding code explosion and appropriate for infrequently executed paths of an operation. These basic mechanisms are provided by the underlying language-agnostic host runtime and allow separation of concerns between guest and host runtime.
We implemented Truffle, the guest language runtime framework, on top of the Graal compiler and the HotSpot virtual machine. So far, there are prototypes for C, J, Python, JavaScript, R, Ruby, and Smalltalk running on top of the Truffle framework. The prototypes are still incomplete with respect to language semantics. However, most of them can run non-trivial benchmarks to demonstrate the core promise of the Truffle system: Multiple languages within one runtime system at competitive performance.
A comparison of apache spark supervised machine learning algorithms for dna s...Valerio Morfino
In this work, we deal with the splicing site prediction problem in DNA sequences by using supervised machine learning algorithms included in the MLlib library of Apache Spark. We show the implementation details and the performance of those algorithms on two public available datasets adopting both local and cloud environments. We compare the performance of the algorithms with U-BRAIN, a general-purpose learning algorithm originally designed for DNA splicing site prediction. Results show that, among the Spark algorithms, all have good prediction accuracy (>0.9) – that is comparable with the one of U-BRAIN – and much lower execution time. Therefore, we can state that Apache Spark machine learning algorithms are promising candidates for dealing with the DNA splicing site prediction problem.
Tech talks annual 2015 william louth_software memories - simulated machinesTechTalks
The document discusses software mirroring and simulation technologies that can record and replay the execution of software systems. It describes how these technologies can mirror running applications, simulate their behavior, and integrate the simulations with monitoring, testing, security and other systems. The simulations allow replaying past executions, diagnosing issues, and gaining insights into software and system behavior.
Tech talks annual 2015 izzet mustafayev_performance testing - the way to make...TechTalks
This document discusses performance testing for web applications. It introduces why performance testing is important, what it is, and how to conduct it. Performance testing determines how a system performs under different workloads by measuring aspects like availability, response time, and throughput. The document recommends testing at various load levels, monitoring applications during tests, using the right tools to minimize impact, and automating testing processes. It promotes continuous performance testing with sufficient data and time.
Lambda expressions were introduced in JDK 8 as a simpler way to represent behaviour. This session looks at usage details and performance compared to anonymous inner classes before diving into Lambda calculus
Proxy Deep Dive JUG Saxony Day 2015-10-02Sven Ruppert
Ein wenig über Proxy´s. Wer mehr Hintergrundinfos dazu haben möchte, empfehle ich das Buch von Dr. Kabutz und mir :
http://www.amazon.de/Dynamic-Proxies-Dr-Heinz-Kabutz/dp/3868021531/ref=asap_bc?ie=UTF8
This document discusses building an "Internet of Trains" project using LEGO trains controlled over WiFi. It describes connecting Raspberry Pis to LEGO trains using infrared transmitters and switches. An Android/web application allows controlling the trains remotely. Challenges included coordinating the distributed system, which the authors addressed using Scala and Akka actors for remote communication between devices. Performance tests showed remote actors had faster response times than HTTP for this real-time control application.
A dive into the world of Lambda expressions in JDK 8, covering the fundamental ideas, some gotchas and a discussion of performance. Finally, just how far can you take Lambdas in Java?
The document discusses Java 8 streams and stream performance. It provides background on streams and why they were introduced in Java 8. It discusses sequential and parallel streams, how to visualize them, and practical benefits. It covers microbenchmarking and a case study comparing a sequential grep implementation to a parallelized version. Key points are that streams can improve readability but performance must be tested, parallelism helps if the workload is large enough to outweigh overhead, and stream sources need to be splittable for parallelism.
SPLAT is a Python tool that generates unit tests lazily and automatically. It uses lazy instantiation to only generate test data for variables that are actively used, improving performance. SPLAT works by wrapping classes and functions with proxy metaclasses that generate test inputs and assertions dynamically during execution based on the bytecode. An evaluation of SPLAT found that it was able to achieve 100% code coverage for sample Python packages and modules in under 500 iterations on average. Future work could improve the tool's sophistication in handling different programming constructs and optimize performance further.
Receiver types allow functions to be declared that operate on a specific receiver type. This includes function types with receivers, which define interfaces for functions, and function literals with receivers, which implement those interfaces. Examples show how Bundle.apply uses a function literal with Bundle as the receiver to configure a Bundle instance. This is a common pattern in Kotlin for building objects through fluent APIs.
The document provides an overview of key differences between Python and Scala. Some key points summarized:
1. Python is a dynamically typed, interpreted language while Scala is statically typed and compiles to bytecode. Scala supports both object-oriented and functional programming paradigms.
2. Scala has features like case classes, traits, and pattern matching that Python lacks. Scala also has features like type parameters, implicit conversions, and tail call optimization that Python does not support natively.
3. Common data structures like lists and maps are implemented differently between the languages - Scala uses immutable Lists while Python uses mutable lists. Scala also has features like lazy vals.
4. Control
The document discusses Alteryx SDKs and APIs. It describes how Alteryx is based on a separation of the Designer GUI and Engine. This allows for various SDKs to create custom tools and functions. The SDKs include ones for custom functions, custom tools with different frontend (HTML, WinForms) and backend (C++, C#, Python) options. It provides examples of XML and C++ based custom functions. It also outlines the processes for creating custom tools, including the interfaces for GUI plugins and engine plugins.
JAX-RS and CDI Bike the (Reactive) BridgeJosé Paumard
This session explains how JAX-RS and CDI became reactive capable in Java EE 8. We put some new features of JAX-RS 2.1 and CDI 2.0 into perspective and show some reactive patterns to improve your application. Add Java 8 CompletionStage to the mix and this API trio becomes your best bet to easily go reactive without leaving the Java EE train.
Tene’s new workshop on ‘StructuredArray – Contained Objects in the Heap’ will examine the key implementation options for deriving speed and memory layout benefits of ObjectLayout’s StructuredArray constructs in future JVM versions, including simple options for adding contained object layout capability to the various existing Garbage Collection mechanisms used by various JVMs.
This document discusses scaling R to large datasets using Scala and Akka. It describes how R has limitations for parallelism and handling large data in memory. The author demonstrates reading a large CSV file of 100 million doubles (1.7GB) in parallel using Scala, Akka actors and Rserve. Producer and Worker actors divide the file and sum parts in Rserve. This allows scaling R computations to large data beyond a single machine's memory. Potential applications mentioned include optimization, distributed linear algebra, machine learning and statistics.
Ibis: Seamless Transition Between Pandas and Apache SparkDatabricks
Pandas is the de facto standard (single-node) Data Frame implementation in Python. However, as data grows larger, pandas no longer works very well due to performance reasons.
This document provides an overview of lambda expressions and streams in Java. It covers lambda syntax, method references, the Stream class and common stream operations like map, filter and reduce. Examples are given to find the highest test score or longest line of text from a stream. The document recommends getting started with the provided LambdasHOL project to complete exercises on lambda and stream operations.
Java Performance: Speedup your application with hardware countersSergey Kuksenko
A modern CPU looks under the cover to understand what performance. What about hardware for Java application performance? Let's understand Performance Monitoring Unit works, Hardware Counters & using them to speeding up Java apps.
The document discusses using aspect oriented programming (AOP) in Python to design APIs. It describes how AOP can help separate concerns like security, logging, and serialization into distinct aspects to avoid scattering code across multiple functions. Decorators are proposed as a way to implement aspects for a bioenergy application API. Specific decorator aspects are presented for security, statistics, serialization, and dispatching API calls to core functions. The implementation applies the aspects as decorators to API functions to cleanly separate the concerns.
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...Thomas Wuerthinger
Multi-language runtimes providing simultaneously high performance for several programming languages still remain an illusion. Industrial-strength managed language runtimes are built with a focus on one language (e.g., Java or C#). Other languages may compile to the bytecode formats of those managed language runtimes. However, the performance characteristics of the bytecode generation approach are often lagging behind compared to language runtimes specialized for a specific language. The performance of JavaScript is for example still orders of magnitude better on specialized runtimes (e.g., V8 or SpiderMonkey).
We present a solution to this problem by providing guest languages with a new way of interfacing with the host runtime. The semantics of the guest language is communicated to the host runtime not via generating bytecodes, but via an interpreter written in the host language. This gives guest languages a simple way to express the semantics of their operations including language-specific mechanisms for collecting profiling feedback. The efficient machine code is derived from the interpreter via automatic partial evaluation. The main components reused from the underlying runtime are the compiler and the garbage collector. They are both agnostic to the executed guest languages.
The host compiler derives the optimized machine code for hot parts of the guest language application via partial evaluation of the guest language interpreter. The interpreter definition can guide the host compiler to generate deoptimization points, i.e., exits from the compiled code. This allows guest language operations to use speculations: An operation could for example speculate that the type of an incoming parameter is constant. Furthermore, the guest language interpreter can use global assumptions about the system state that are registered with the compiled code. Finally, part of the interpreter's code can be excluded from the partial evaluation and remain shared across the system. This is useful for avoiding code explosion and appropriate for infrequently executed paths of an operation. These basic mechanisms are provided by the underlying language-agnostic host runtime and allow separation of concerns between guest and host runtime.
We implemented Truffle, the guest language runtime framework, on top of the Graal compiler and the HotSpot virtual machine. So far, there are prototypes for C, J, Python, JavaScript, R, Ruby, and Smalltalk running on top of the Truffle framework. The prototypes are still incomplete with respect to language semantics. However, most of them can run non-trivial benchmarks to demonstrate the core promise of the Truffle system: Multiple languages within one runtime system at competitive performance.
A comparison of apache spark supervised machine learning algorithms for dna s...Valerio Morfino
In this work, we deal with the splicing site prediction problem in DNA sequences by using supervised machine learning algorithms included in the MLlib library of Apache Spark. We show the implementation details and the performance of those algorithms on two public available datasets adopting both local and cloud environments. We compare the performance of the algorithms with U-BRAIN, a general-purpose learning algorithm originally designed for DNA splicing site prediction. Results show that, among the Spark algorithms, all have good prediction accuracy (>0.9) – that is comparable with the one of U-BRAIN – and much lower execution time. Therefore, we can state that Apache Spark machine learning algorithms are promising candidates for dealing with the DNA splicing site prediction problem.
Tech talks annual 2015 william louth_software memories - simulated machinesTechTalks
The document discusses software mirroring and simulation technologies that can record and replay the execution of software systems. It describes how these technologies can mirror running applications, simulate their behavior, and integrate the simulations with monitoring, testing, security and other systems. The simulations allow replaying past executions, diagnosing issues, and gaining insights into software and system behavior.
Tech talks annual 2015 izzet mustafayev_performance testing - the way to make...TechTalks
This document discusses performance testing for web applications. It introduces why performance testing is important, what it is, and how to conduct it. Performance testing determines how a system performs under different workloads by measuring aspects like availability, response time, and throughput. The document recommends testing at various load levels, monitoring applications during tests, using the right tools to minimize impact, and automating testing processes. It promotes continuous performance testing with sufficient data and time.
Model-based Research in Human-Computer Interaction (HCI): Keynote at Mensch u...Ed Chi
- The document discusses human-computer interaction (HCI) research conducted at Xerox PARC in the 1970s and 1980s.
- Early contributions came from computer scientists interested in changing how people interact with information and psychologists studying the implications.
- Research established HCI as a science by adopting psychological methods and building an HCI techniques science.
(In Swedish) Peter Mackhé of the Swedish research bureau Dagens Analys walks you through the fast paced evolution in customer behavior and how to capture and create insights from the data points created when interacting with your brand.
BirchBox the Future Business Model of E-CommerceYelena Starikova
Table of Contents
Executive Summary ii
Table of Figures ix
Introduction 1
E-Commerce 3
-Current Statistics 3
-History of E-Commerce 7
-Mobile Commerce 13
-Tablets and Future of E-commerce 14
-Advantages &Disadvantages of E-Commerce 18
Subscription Business Model 20
-What is Subscription Business Model? 20
Birchbox: the Mother of all Boxes 24
-BirchBox Overview 24
-BirchBox Healthy growth 26
-BirchBox Business Model 27
-BirchBox Challenges 33
Other Good Box Examples 34
-Lacquerous 34
-Manpacks 35
-Nature Box 36
-Why some subscription boxes are successful? 39
Failed Boxes 42
-Ellie 42
-Dollar Shave Club 44
-Rocksbox 46
-Why Boxes Fail? 47
Current Waves that are driving the Market 48
1. Social Commerce 48
2. Private Sales 53
3. Mobile / Location 54
Future E-Commerce Trends 55
1. Data is the beating heart of e-commerce 55
2. Cutting Out the Middle Man 56
3. Always-on shopping experiences 56
4.Social Shopping: Video experience in E-commerce 57
Conclusion 60
Recommendations for BirchBox 62
Bibliography 63
Appendix 76
NOTE: Guys, due to the high demand and time that I spend on sending out this report as a favor, I am starting to charge a fee of $25 if you would like to have my thesis. No more favors!
If interested, email me at starikovayelena@gmail.com
Conventional and non-conventional energy sources, Hydro-electric, Thermal, Nuclear, Wind, Solar(with block diagram)
Boiler- Water tube and Fire tube, Internal Combustion Engines–Two stroke and four stroke (spark ignition and compression ignition), Turbines– Impulse & Reaction
Introduction to Manufacturing Processes and their Applications (Casting, Forging, Sheet metal working and Metal joining processes), Description of Casting process: Sand casting(Cope&Drag). Sheet metal Forming,(shearing, bending, drawing), Forging (Hot working and cold working comparison) ,Electric Arc welding, Comparison of Welding, Soldering, Brazing
This document provides an overview of mechanical drives and power transmission maintenance. It discusses various types of drives including gear drives, belt drives, v-belt drives, chain drives, and discusses maintenance of sprockets and roller chains. The document provides information on components, operating principles, installation, alignment and preventative maintenance of these various mechanical drive systems.
This document provides an overview of the state of robotics in 2015. It discusses major trends seen that year, including faster/cheaper components, more startups and funding, and the growing robot-as-a-service model. Specific areas covered include drones becoming more advanced and popular, progress in autonomous vehicles, the expansion of service robots into new industries, lifestyle robots entering homes, and continued development of social robots.
Finagle is an asynchronous RPC framework from Twitter that provides client/server abstractions over various protocols like HTTP and Thrift. It uses Futures to handle asynchronous operations and provides methods like map, flatmap, and handle to transform Futures. The Java Service Framework builds on Finagle to add features like metrics, logging, and rate limiting for Java services. It allows configuring options like enabling specific logs and metrics through a Proxy builder.
The document summarizes a presentation about using Java 8 streams effectively. It discusses converting imperative code that processes a log file into stream-based code. It shows how streams can be parallelized to improve performance but notes there are many factors that determine whether parallelization actually helps or hurts. Key points include how streams lazily process data in pipelines, splitting data sources efficiently, and bottlenecks like I/O that prevent parallelism from scaling well.
Production Time Profiling and Diagnostics on the JVMMarcus Hirt
These are the slides for my Code One 2018 talk on profiling and diagnostics on the JVM. The talk goes through various serviceability technologies built into the JVM, but with a focus on the production time use cases.
Cooperative Task Execution for Apache SparkDatabricks
Apache Spark has enabled a vast assortment of users to express batch, streaming, and machine learning computations, using a mixture of programming paradigms and interfaces. Lately, we observe that different jobs are often implemented as part of the same application to share application logic, state, or to interact with each other. Examples include online machine learning, real-time data transformation and serving, low-latency event monitoring and reporting. Although the recent addition of Structured Streaming to Spark provides the programming interface to enable such unified applications over bounded and unbounded data, the underlying execution engine was not designed to efficiently support jobs with different requirements (i.e., latency vs. throughput) as part of the same runtime. It therefore becomes particularly challenging to schedule such jobs to efficiently utilize the cluster resources while respecting their requirements in terms of task response times. Scheduling policies such as FAIR could alleviate the problem by prioritizing critical tasks, but the challenge remains, as there is no way to guarantee no queuing delays. Even though preemption by task killing could minimize queuing, it would also require task resubmission and loss of progress, leading to wasted cluster resources. In this talk, we present Neptune, a new cooperative task execution model for Spark with fine-grained control over resources such as CPU time. Neptune utilizes Scala coroutines as a lightweight mechanism to suspend task execution with sub-millisecond latency and introduces new scheduling policies that respect diverse task requirements while efficiently sharing the same runtime. Users can directly use Neptune for their continuous applications as it supports all existing DataFrame, DataSet, and RDD operators. We present an implementation of the execution model as part of Spark 2.4.0 and describe the observed performance benefits from running a number of streaming and machine learning workloads on an Azure cluster.
Speaker: Konstantinos Karanasos
This document discusses parallelization and multithreading techniques in .NET. It covers multithreading using AsyncEnumerator, which simplifies asynchronous programming. It also covers the Parallel Extensions to .NET Framework, including the Task Parallel Library for implicit parallelism using Parallel.For and Parallel.ForEach, and Parallel LINQ (PLINQ) for parallel querying of data sources. The document provides examples and discusses concepts like cancellation, exceptions, and thread safety.
Ob1k is a new open source RPC container. it belongs to a new breed of frameworks that tries to improve on the classic J2EE model by embedding the server and reducing redundant bloatware. Ob1k supports two modes of operations: sync and async, the async mode aims for maximum performance by adopting reactive principals like using non-blocking code and functional composition using futures. Ob1k also aims to be ops/devops friendly by being self contained and easily configured.
Ingesting streaming data for analysis in apache ignite (stream sets theme)Tom Diederich
Apache Ignite provides a distributed platform for a wide variety of workloads, but often the issue is simply in getting data into the database in the first place. The wide variety of data sources and formats presents a challenge to any data engineer; in addition, 'data drift', the constant and inevitable mutation of the incoming data's structure and semantics, can break even the most well-engineered integration.
This session, aimed at data architects, data engineers and developers, will explore how we can use the open source StreamSets Data Collector to build robust data pipelines. Attendees will learn how to collect data from cloud platforms such as Amazon and Salesforce, devices, relational databases and other sources, continuously stream it to Ignite, and then use features such as Ignite's continuous queries to perform streaming analysis.
We'll start by covering the basics of reading files from disk, move on to relational databases, then look at more challenging sources such as APIs and message queues. You will learn how to:
* Build data pipelines to ingest a wide variety of data into Apache Ignite
* Anticipate and manage data drift to ensure that data keeps flowing
* Perform simple and complex ad-hoc queries in Ignite via SQL
* Write applications using Ignite to run continuous queries, combining data from multiple sources
Visual Studio 2010 and .NET 4 provide new tools for parallel programming including Parallel LINQ (PLINQ) and the Task Parallel Library (TPL). PLINQ allows existing LINQ queries to run in parallel by partitioning and merging data across threads. The TPL simplifies writing multithreaded code through tasks that represent asynchronous and parallel operations. These new frameworks make it easier for developers to write scalable parallel code that takes advantage of multicore processors.
C++ Generators and Property-based TestingSumant Tambe
This document discusses property-based testing using generators. It introduces the concept of generators and how they can be used to automatically generate random test inputs. The document outlines several key points:
- Generators can be composed together using operations like map, zip, and concat to produce complex generators from simple ones.
- Generators form algebraic structures like functors, monoids, and monads that allow them to be composed while satisfying certain mathematical laws.
- The generator library implements generators as classes with methods derived from these algebraic structures, allowing generators to be easily composed and transformed in a consistent way.
This chapter discusses message-passing programming using MPI. It covers the message-passing model, how MPI programs execute, fundamental MPI functions, coding, compiling, running and benchmarking MPI programs. The document provides examples of coding a circuit satisfiability program in MPI using concepts like determining the number of processes, cyclic allocation of work, and reducing results across processes.
Taking Jenkins Pipeline to the Extremeyinonavraham
Slide deck from Jenkins User Conference Tel Aviv 2018.
Talking about suggested (best?) practices, tips and tricks, using Jenkins pipeline scripts with shared libraries, managing shared libraries, using docker compose, and more.
This document discusses plans for JAX-RS 2.1 (also known as JAX-RS.next), which aims to improve the JAX-RS specification. Some key areas of focus include improving performance through reactive programming and streams, better aligning with Java EE standards like CDI and JSON-B, filling gaps like server-sent events support, and continued evolution of the API. The overview outlines proposed features and the agenda for an upcoming presentation on the topic.
DevoxxUK: Optimizating Application Performance on KubernetesDinakar Guniguntala
Now that you have your apps running on K8s, wondering how to get the response time that you need ? Tuning a polyglot set of microservices to get the performance that you need can be challenging in Kubernetes. The key to overcoming this is observability. Luckily there are a number of tools such as Prometheus that can provide all the metrics you need, but here is the catch, there is so much of data and metrics that is difficult make sense of it all. This is where Hyperparameter tuning can come to the rescue to help build the right models.
This talk covers best practices that will help attendees
1. To understand and avoid common performance related problems.
2. Discuss observability tools and how they can help identify perf issues.
3. Look closer into Kruize Autotune which is a Open Source Autonomous Performance Tuning Tool for Kubernetes and where it can help.
This document discusses shared-memory parallel programming using OpenMP. It begins with an overview of OpenMP and the shared-memory programming model. It then covers key OpenMP constructs for parallelizing loops, including the parallel for pragma and clauses for declaring private variables. It also discusses managing shared data with critical sections and reductions. The document provides several techniques for improving performance, such as loop inversions, if clauses, and dynamic scheduling.
Presentation from Riga Dev Day talking about Lambda expressions and the Stream API in JDK8. This session, as the title suggests, goes beyond the basics and discusses some of the different ways you need to think to use a functional style of programming in Java.
This document summarizes key features introduced in Java SE 5.0 (Tiger) including generics, autoboxing/unboxing, enhanced for loops, type-safe enums, varargs, static imports, and annotations. It also discusses performance enhancements in the virtual machine as well as new concurrency utilities like Executors and ScheduledExecutorService that make multi-threaded programming easier and more robust.
Mastering the Sling Rewriter by Justin EdelsonAEM HUB
The Sling Rewriter is a module included in AEM that performs transformations on rendered content like HTML. It uses a pipeline-oriented approach based on SAX events to pass content through generators, transformers, and serializers without knowledge of the underlying components. Key aspects include defining rewriter configurations and pipelines, and implementing transformers by processing SAX events to modify content.
The Sling Rewriter is an Apache Sling module included in AEM that performs transformations on rendered content like HTML. It uses a pipeline-oriented approach based on SAX events to apply transformers without knowledge of specific components. The document discusses how rewriter pipelines are configured and customized transformers can be implemented to transform content according to use cases.
This session talks about how unit testing of Spark applications is done, as well as tells the best way to do it. This includes writing unit tests with and without Spark Testing Base package, which is a spark package containing base classes to use when writing tests with Spark.
WCF Data Services (formerly known as "ADO.NET Data Services") is a component of the .NET Framework that enables you to create services that use the Open Data Protocol (OData) to expose and consume data over the Web or intranet by using the semantics of representational state transfer (REST). OData exposes data as resources that are addressable by URIs. Data is accessed and changed by using standard HTTP verbs of GET, PUT, POST, and DELETE. OData uses the entity-relationship conventions of the Entity Data Model to expose resources as sets of entities that are related by associations.
Similar to Tech talks annual 2015 kirk pepperdine_ripping apart java 8 streams (20)
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc
How does your privacy program stack up against your peers? What challenges are privacy teams tackling and prioritizing in 2024?
In the fifth annual Global Privacy Benchmarks Survey, we asked over 1,800 global privacy professionals and business executives to share their perspectives on the current state of privacy inside and outside of their organizations. This year’s report focused on emerging areas of importance for privacy and compliance professionals, including considerations and implications of Artificial Intelligence (AI) technologies, building brand trust, and different approaches for achieving higher privacy competence scores.
See how organizational priorities and strategic approaches to data security and privacy are evolving around the globe.
This webinar will review:
- The top 10 privacy insights from the fifth annual Global Privacy Benchmarks Survey
- The top challenges for privacy leaders, practitioners, and organizations in 2024
- Key themes to consider in developing and maintaining your privacy program
20 Comprehensive Checklist of Designing and Developing a WebsitePixlogix Infotech
Dive into the world of Website Designing and Developing with Pixlogix! Looking to create a stunning online presence? Look no further! Our comprehensive checklist covers everything you need to know to craft a website that stands out. From user-friendly design to seamless functionality, we've got you covered. Don't miss out on this invaluable resource! Check out our checklist now at Pixlogix and start your journey towards a captivating online presence today.
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2024/06/building-and-scaling-ai-applications-with-the-nx-ai-manager-a-presentation-from-network-optix/
Robin van Emden, Senior Director of Data Science at Network Optix, presents the “Building and Scaling AI Applications with the Nx AI Manager,” tutorial at the May 2024 Embedded Vision Summit.
In this presentation, van Emden covers the basics of scaling edge AI solutions using the Nx tool kit. He emphasizes the process of developing AI models and deploying them globally. He also showcases the conversion of AI models and the creation of effective edge AI pipelines, with a focus on pre-processing, model conversion, selecting the appropriate inference engine for the target hardware and post-processing.
van Emden shows how Nx can simplify the developer’s life and facilitate a rapid transition from concept to production-ready applications.He provides valuable insights into developing scalable and efficient edge AI solutions, with a strong focus on practical implementation.
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfMalak Abu Hammad
Discover how MongoDB Atlas and vector search technology can revolutionize your application's search capabilities. This comprehensive presentation covers:
* What is Vector Search?
* Importance and benefits of vector search
* Practical use cases across various industries
* Step-by-step implementation guide
* Live demos with code snippets
* Enhancing LLM capabilities with vector search
* Best practices and optimization strategies
Perfect for developers, AI enthusiasts, and tech leaders. Learn how to leverage MongoDB Atlas to deliver highly relevant, context-aware search results, transforming your data retrieval process. Stay ahead in tech innovation and maximize the potential of your applications.
#MongoDB #VectorSearch #AI #SemanticSearch #TechInnovation #DataScience #LLM #MachineLearning #SearchTechnology
In the rapidly evolving landscape of technologies, XML continues to play a vital role in structuring, storing, and transporting data across diverse systems. The recent advancements in artificial intelligence (AI) present new methodologies for enhancing XML development workflows, introducing efficiency, automation, and intelligent capabilities. This presentation will outline the scope and perspective of utilizing AI in XML development. The potential benefits and the possible pitfalls will be highlighted, providing a balanced view of the subject.
We will explore the capabilities of AI in understanding XML markup languages and autonomously creating structured XML content. Additionally, we will examine the capacity of AI to enrich plain text with appropriate XML markup. Practical examples and methodological guidelines will be provided to elucidate how AI can be effectively prompted to interpret and generate accurate XML markup.
Further emphasis will be placed on the role of AI in developing XSLT, or schemas such as XSD and Schematron. We will address the techniques and strategies adopted to create prompts for generating code, explaining code, or refactoring the code, and the results achieved.
The discussion will extend to how AI can be used to transform XML content. In particular, the focus will be on the use of AI XPath extension functions in XSLT, Schematron, Schematron Quick Fixes, or for XML content refactoring.
The presentation aims to deliver a comprehensive overview of AI usage in XML development, providing attendees with the necessary knowledge to make informed decisions. Whether you’re at the early stages of adopting AI or considering integrating it in advanced XML development, this presentation will cover all levels of expertise.
By highlighting the potential advantages and challenges of integrating AI with XML development tools and languages, the presentation seeks to inspire thoughtful conversation around the future of XML development. We’ll not only delve into the technical aspects of AI-powered XML development but also discuss practical implications and possible future directions.
Maruthi Prithivirajan, Head of ASEAN & IN Solution Architecture, Neo4j
Get an inside look at the latest Neo4j innovations that enable relationship-driven intelligence at scale. Learn more about the newest cloud integrations and product enhancements that make Neo4j an essential choice for developers building apps with interconnected data and generative AI.
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
Building RAG with self-deployed Milvus vector database and Snowpark Container...Zilliz
This talk will give hands-on advice on building RAG applications with an open-source Milvus database deployed as a docker container. We will also introduce the integration of Milvus with Snowpark Container Services.
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
How to Get CNIC Information System with Paksim Ga.pptxdanishmna97
Pakdata Cf is a groundbreaking system designed to streamline and facilitate access to CNIC information. This innovative platform leverages advanced technology to provide users with efficient and secure access to their CNIC details.
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Speck&Tech
ABSTRACT: A prima vista, un mattoncino Lego e la backdoor XZ potrebbero avere in comune il fatto di essere entrambi blocchi di costruzione, o dipendenze di progetti creativi e software. La realtà è che un mattoncino Lego e il caso della backdoor XZ hanno molto di più di tutto ciò in comune.
Partecipate alla presentazione per immergervi in una storia di interoperabilità, standard e formati aperti, per poi discutere del ruolo importante che i contributori hanno in una comunità open source sostenibile.
BIO: Sostenitrice del software libero e dei formati standard e aperti. È stata un membro attivo dei progetti Fedora e openSUSE e ha co-fondato l'Associazione LibreItalia dove è stata coinvolta in diversi eventi, migrazioni e formazione relativi a LibreOffice. In precedenza ha lavorato a migrazioni e corsi di formazione su LibreOffice per diverse amministrazioni pubbliche e privati. Da gennaio 2020 lavora in SUSE come Software Release Engineer per Uyuni e SUSE Manager e quando non segue la sua passione per i computer e per Geeko coltiva la sua curiosità per l'astronomia (da cui deriva il suo nickname deneb_alpha).
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slackshyamraj55
Discover the seamless integration of RPA (Robotic Process Automation), COMPOSER, and APM with AWS IDP enhanced with Slack notifications. Explore how these technologies converge to streamline workflows, optimize performance, and ensure secure access, all while leveraging the power of AWS IDP and real-time communication via Slack notifications.
1. Copyright 2015 Kirk Pepperdine. All rights reserved
Ripping Apart Java 8
Parallel Streams
Kirk Pepperdine
2. Copyright 2015 Kirk Pepperdine. All rights reserved
About Me
Specialize in performance tuning
speak frequently about performance
author of performance tuning workshop
Co-founder jClarity
performance diagnositic tooling
Java Champion (since 2006)
4. Copyright 2015 Kirk Pepperdine. All rights reserved
Java 8 Lambda expressions
Syntaxtic sugar for a specific type of inner class
(parameters) -> body;
() -> 42;
(x,y) -> x * y;
5. Copyright 2015 Kirk Pepperdine. All rights reserved
Java 8 Lambda expressions
Pattern applicationTimePattern = Pattern.
compile("(d+.d+): Application time: (d+.d+)");
Function<String,Matcher> match = new Function<String,Matcher>() {
@Override
public Matcher apply(String logEntry) {
return applicationTimePattern.matcher(logEntry);
}
};
String example = "2.869: Application time: 1.0001540 seconds";
Matcher matcher = match.apply(example);
6. Copyright 2015 Kirk Pepperdine. All rights reserved
Java 8 Lambda expressions
Pattern applicationTimePattern = Pattern.
compile("(d+.d+): Application time: (d+.d+)");
Function<String,Matcher> match =
logEntry -> applicationTimePattern.matcher(logEntry);
String example = "2.869: Application time: 1.0001540 seconds";
Matcher matcher = match.apply(example);
7. Copyright 2015 Kirk Pepperdine. All rights reserved
Java 8 Lambda expressions
Pattern applicationTimePattern = Pattern.
compile("(d+.d+): Application time: (d+.d+)");
Function<String,Matcher> match =
logEntry -> applicationTimePattern.matcher(logEntry);
Predicate<Matcher> matches = new Predicate<Matcher>() {
@Override
public boolean test(Matcher matcher) {
return matcher.find();
}
};
String example = "2.869: Application time: 1.0001540 seconds";
8. Copyright 2015 Kirk Pepperdine. All rights reserved
Java 8 Lambda expressions
Pattern applicationTimePattern = Pattern.
compile("(d+.d+): Application time: (d+.d+)");
Function<String,Matcher> match =
logEntry -> applicationTimePattern.matcher(logEntry);
Predicate<Matcher> matches = matcher -> matcher.find();
String example = "2.869: Application time: 1.0001540 seconds”;
Boolean b = matches.test(match.apply(example));
9. Copyright 2015 Kirk Pepperdine. All rights reserved
Java 8 Lambda expressions
Pattern applicationTimePattern = Pattern.
compile("(d+.d+): Application time: (d+.d+)");
Function<String,Matcher> match =
logEntry -> applicationTimePattern.matcher(logEntry);
Predicate<Matcher> matches = matcher -> matcher.find();
Function<Matcher,String> extract = matcher -> {
if ( matches.test( matcher))
return matcher.group(2);
else return "";
};
String example = "2.869: Application time: 1.0001540 seconds”;
String value = extract.apply(match.apply(example));
11. Copyright 2015 Kirk Pepperdine. All rights reserved
Lazy Execution
for ( int i = 0; i < 5000; i++) {
LOGGER.fine (() -> "Trace value: " + getValue());
}
for ( int i = 0; i < 5000; i++) {
LOGGER.fine ("Trace value: " + getValue());
}
3200ms
0ms
13. Copyright 2015 Kirk Pepperdine. All rights reserved
Language changes in Java 8
Method references
String::length
aString::length
ClassName::new
(aString) -> aString::length;
14. Copyright 2015 Kirk Pepperdine. All rights reserved
Stream
Abstraction that allows you to apply a set of
functions over the elements in a collection
functions are combined to form a stream pipeline
sequential or parallel
operations divided into intermediate and terminal
operations
15. Copyright 2015 Kirk Pepperdine. All rights reserved
Stream
Defined in interface Collection::stream()
many classes implement stream()
Arrays.stream(Object[])
Stream.of(Object[]), .iterate(Object,UnaryOperator)
File.lines(), BufferedReader.lines(), Random.ints(),
JarFile.stream()
16. Copyright 2015 Kirk Pepperdine. All rights reserved
Old School Code
public void imperative() throws IOException {
Population pop = new Population();
String logRecord;
double value = 0.0d;
BufferedReader reader = new BufferedReader(new FileReader(gcLogFileName));
while ( ( logRecord = reader.readLine()) != null) {
Matcher matcher = applicationStoppedTimePattern.matcher(logRecord);
if ( matcher.find()) {
pop.add(Double.parseDouble( matcher.group(2)));
}
}
System.out.println(pop.toString());
}
17. Copyright 2015 Kirk Pepperdine. All rights reserved
gcLogEntries.stream()
.map(applicationStoppedTimePattern::matcher)
.filter(Matcher::find)
.map(matcher -> matcher.group(2))
.mapToDouble(Double::parseDouble)
.summaryStatistics();
data source
start streaming
map to Matcher
filter out
uninteresting bits
map to Double
extract group
aggregate results
19. Copyright 2015 Kirk Pepperdine. All rights reserved
Parallel Streams
If collection supports Spliterator operations can
be performed in parallel
Spliterator is like an internal iterator
split source into several spliterator
traverse source
Many of the same rules as Iterator
however may work (non-deterministically) with I/O
20. Copyright 2015 Kirk Pepperdine. All rights reserved
gcLogEntries.stream().parallel().
.map(applicationStoppedTimePattern::matcher)
.filter(Matcher::find)
.map(matcher -> matcher.group(2))
.mapToDouble(Double::parseDouble)
.summaryStatistics();
parallelize stream
24. Copyright 2015 Kirk Pepperdine. All rights reserved
Flat profile of 8.70 secs (638 total ticks): ForkJoinPool.commonPool-worker-3
Compiled + native Method
60.8% 118 + 0 java.util.concurrent.ForkJoinTask.doExec
Raw Profiler Output
25. Copyright 2015 Kirk Pepperdine. All rights reserved
Flat profile of 8.70 secs (638 total ticks): ForkJoinPool.commonPool-worker-3
Compiled + native Method
60.8% 118 + 0 java.util.concurrent.ForkJoinTask.doExec
Raw Profiler Output
Learned 2 things very quickly
Parallel streams use Fork-Join
Fork-Join comes with some significant over-
head
26. Copyright 2015 Kirk Pepperdine. All rights reserved
Predicted that applcations using parallel
streams would
For other reasons….
run very very slowly
30. Copyright 2015 Kirk Pepperdine. All rights reserved
You have a finite amount of hardware
it might be in your best interest to grab it all
if everyone behaves the same way….
Be a good neighbour
31. Copyright 2015 Kirk Pepperdine. All rights reserved
Handoff Costs
It costs about ~80,000 clocks to handoff data
between threads
overhead = 80000*handoff rate/cycles
10%= 80000*handoff rate/2000000000
~2500 handoffs/sec
32. Copyright 2015 Kirk Pepperdine. All rights reserved
CPNQ Performance Model
C - number of submitters
P - number of CPUs
N - number of elements
Q - cost of the operation
33. Copyright 2015 Kirk Pepperdine. All rights reserved
C/P/N/Q
Need to amortize setup costs
NQ needs to be large
Q can often only be estimated
N often should be > 10,000 elements
P assumes CPU is the limiting resource
34. Copyright 2015 Kirk Pepperdine. All rights reserved
Fork-Join
Support for Fork-Join added in Java 7
difficult coding idiom to master
Streams make Fork-Join more reachable
how fork-join works and performs is important to your
latency picture
35. Copyright 2015 Kirk Pepperdine. All rights reserved
Implementation
Used internally by a parallel stream
break the stream up into chunks and submit each chunk
as a ForkJoinTask
apply filter().map().reduce() to each ForkJoinTask
Calls ForkJoinTask invoke() and join() to retrieve results
36. Copyright 2015 Kirk Pepperdine. All rights reserved
Common Thread Pool
Fork-Join by default uses a common thread pool
default number of worker threads == number of logical
cores - 1
Always contains at least one thread
37. Copyright 2015 Kirk Pepperdine. All rights reserved
Little’s Law
Fork-Join uses a work queue
work queue behavior can be modeled using Little’s Law
Number of tasks in the system is the
Arrival rate * average service time
38. Copyright 2015 Kirk Pepperdine. All rights reserved
Little’s Law Example
System sees 400 TPS. It takes 100ms to process a
request
Number of tasks in system = 0.100 * 400 = 40
On an 8 core machine
implies 39 Fork-Join tasks are sitting in queue
accumulating dead time
40*100 = 4000 ms of which 3900 is dead time
97.5% of service time is in waiting
39. Copyright 2015 Kirk Pepperdine. All rights reserved
Normal Reaction
if there is sufficient capacity then
make the pool bigger
else
add capacity
or
tune to reduce strength of the dependency
40. Copyright 2015 Kirk Pepperdine. All rights reserved
Configuring Common Pool
Size of common ForkJoinPool is
Runtime.getRuntime().availableProcessors() - 1
Can configure things
-Djava.util.concurrent.ForkJoinPool.common.parallelism=N
-Djava.util.concurrent.ForkJoinPool.common.threadFactory
-Djava.util.concurrent.ForkJoinPool.common.exceptionHandler
41. Copyright 2015 Kirk Pepperdine. All rights reserved
All Hands on Deck!!!
Everyone is working together to get it done!
42. Copyright 2015 Kirk Pepperdine. All rights reserved
Resource Dependency
If task is CPU bound, you can’t increase the size
of the thread pool
CPU may not be the limiting factor
throughput is limited by another dependent resource
I/O, shared variable (lock)
Adding threads == increased latency
predicted by Little’s Law
43. Copyright 2015 Kirk Pepperdine. All rights reserved
ForkJoinPool invoke
ForkJoinPool.invoke(ForkJoinTask) uses the
submitting thread as a worker
If 100 threads all call invoke(), we would have
100+ForkJoinThreads exhausting the limiting resource, e.g.
CPUs, IO, etc.
44. Copyright 2015 Kirk Pepperdine. All rights reserved
ForkJoinPool submit/get
ForkJoinPool.submit(Callable).get() suspends the
submitting thread
If 100 jobs all call submit(), the work queue can become
very long, thus adding latency
45. Copyright 2015 Kirk Pepperdine. All rights reserved
Our own ForkJoinPool
When used inside a ForkJoinPool, the
ForkJoinTask.fork() method uses the current pool
ForkJoinPool ourOwnPool = new ForkJoinPool(10);
ourOwnPool.invoke(() -> stream.parallel(). …
46. Copyright 2015 Kirk Pepperdine. All rights reserved
ForkJoinPool
public void parallel() throws IOException {
ForkJoinPool forkJoinPool = new ForkJoinPool(10);
Stream<String> stream = Files.lines(
new File(gcLogFileName).toPath());
forkJoinPool.submit(() ->
stream.parallel()
.map(applicationStoppedTimePattern::matcher)
.filter(Matcher::find)
.map(matcher -> matcher.group(2))
.mapToDouble(Double::parseDouble)
.summaryStatistics().toString());
}
47. Copyright 2015 Kirk Pepperdine. All rights reserved
ForkJoinPool Observability
ForkJoinPool comes with no visibility
need to instrument ForkJoinTask.invoke()
gather needed from ForkJoinPool needed to feed into
Little’s Law
48. Copyright 2015 Kirk Pepperdine. All rights reserved
Instrumenting ForkJoinPool
We can get the statistics needed from
ForkJoinPool needed for Little’s Law
need to instrument ForkJoinTask::invoke()
public final V invoke() {
ForkJoinPool.common.getMonitor().submitTask(this);
int s;
if ((s = doInvoke() & DONE_MASK) != NORMAL) reportException(s);
ForkJoinPool.common.getMonitor().retireTask(this);
return getRawResult();
}
49. Copyright 2015 Kirk Pepperdine. All rights reserved
In an application where you have many
parallel stream operations all running
concurrently performance will be limited
by the size of the common thread pool
51. Copyright 2015 Kirk Pepperdine. All rights reserved
Performance
Submitt log parsing to our own ForkJoinPool
new ForkJoinPool(16).submit(() -> ……… ).get()
new ForkJoinPool(8).submit(() -> ……… ).get()
new ForkJoinPool(4).submit(() -> ……… ).get()
52. Copyright 2015 Kirk Pepperdine. All rights reserved
16 worker
threads
8 worker
threads
4 worker
threads
53. Copyright 2015 Kirk Pepperdine. All rights reserved
0
75000
150000
225000
300000
Stream Parallel Flood Stream Flood Parallel
54. Copyright 2015 Kirk Pepperdine. All rights reserved
Going parallel might not give you the expected gains
55. Copyright 2015 Kirk Pepperdine. All rights reserved
You may not know this until you hit production!
56. Copyright 2015 Kirk Pepperdine. All rights reserved
Monitoring internals of JDK is important to
understanding where bottlenecks are
57. Copyright 2015 Kirk Pepperdine. All rights reserved
JDK is not all that well instrumented
58. Copyright 2015 Kirk Pepperdine. All rights reserved
APIs have changed so you need to re-read the
javadocs
even for your old familiar classes
59. Copyright 2015 Kirk Pepperdine. All rights reserved
Performance Seminar
www.kodewerk.com
Java
Performance
Tuning,
May 26-29, Chania
Greece