售 价:¥
9.8
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐

Clojure High Performance Programming Second Edition
Table of Contents
Clojure High Performance Programming Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
eBooks, discount offers, and more
Questions
1. Performance by Design
Use case classification
The user-facing software
Computational and data-processing tasks
A CPU bound computation
A memory bound task
A cache bound task
An input/output bound task
Online transaction processing
Online analytical processing
Batch processing
A structured approach to the performance
The performance vocabulary
Latency
Throughput
Bandwidth
Baseline and benchmark
Profiling
Performance optimization
Concurrency and parallelism
Resource utilization
Workload
The latency numbers that every programmer should know
Summary
2. Clojure Abstractions
Non-numeric scalars and interning
Identity, value, and epochal time model
Variables and mutation
Collection types
Persistent data structures
Constructing lesser-used data structures
Complexity guarantee
O(<7) implies near constant time
The concatenation of persistent data structures
Sequences and laziness
Laziness
Laziness in data structure operations
Constructing lazy sequences
Custom chunking
Macros and closures
Transducers
Performance characteristics
Transients
Fast repetition
Performance miscellanea
Disabling assertions in production
Destructuring
Recursion and tail-call optimization (TCO)
Premature end of iteration
Multimethods versus protocols
Inlining
Summary
3. Leaning on Java
Inspecting the equivalent Java source for Clojure code
Creating a new project
Compiling the Clojure sources into Java bytecode
Decompiling the .class files into Java source
Compiling the Clojure source without locals clearing
Numerics, boxing, and primitives
Arrays
Reflection and type hints
An array of primitives
Primitives
Macros and metadata
String concatenation
Miscellaneous
Using array/numeric libraries for efficiency
HipHip
primitive-math
Detecting boxed math
Resorting to Java and native code
Proteus – mutable locals in Clojure
Summary
4. Host Performance
The hardware
Processors
Branch prediction
Instruction scheduling
Threads and cores
Memory systems
Cache
Interconnect
Storage and networking
The Java Virtual Machine
The just-in-time compiler
Memory organization
HotSpot heap and garbage collection
Measuring memory (heap/stack) usage
Determining program workload type
Tackling memory inefficiency
Measuring latency with Criterium
Criterium and Leiningen
Summary
5. Concurrency
Low-level concurrency
Hardware memory barrier (fence) instructions
Java support and the Clojure equivalent
Atomic updates and state
Atomic updates in Java
Clojure's support for atomic updates
Faster writes with atom striping
Asynchronous agents and state
Asynchrony, queueing, and error handling
Why you should use agents
Nesting
Coordinated transactional ref and state
Ref characteristics
Ref history and in-transaction deref operations
Transaction retries and barging
Upping transaction consistency with ensure
Lesser transaction retries with commutative operations
Agents can participate in transactions
Nested transactions
Performance considerations
Dynamic var binding and state
Validating and watching the reference types
Java concurrent data structures
Concurrent maps
Concurrent queues
Clojure support for concurrent queues
Concurrency with threads
JVM support for threads
Thread pools in the JVM
Clojure concurrency support
Future
Promise
Clojure parallelization and the JVM
Moore's law
Amdahl's law
Universal Scalability Law
Clojure support for parallelization
pmap
pcalls
pvalues
Java 7's fork/join framework
Parallelism with reducers
Reducible, reducer function, reduction transformation
Realizing reducible collections
Foldable collections and parallelism
Summary
6. Measuring Performance
Performance measurement and statistics
A tiny statistics terminology primer
Median, first quartile, third quartile
Percentile
Variance and standard deviation
Understanding Criterium output
Guided performance objectives
Performance testing
The test environment
What to test
Measuring latency
Comparative latency measurement
Latency measurement under concurrency
Measuring throughput
Average throughput test
The load, stress, and endurance tests
Performance monitoring
Monitoring through logs
Ring (web) monitoring
Introspection
JVM instrumentation via JMX
Profiling
OS and CPU/cache-level profiling
I/O profiling
Summary
7. Performance Optimization
Project setup
Software versions
Leiningen project.clj configuration
Enable reflection warning
Enable optimized JVM options when benchmarking
Distinguish between initialization and runtime
Identifying performance bottlenecks
Latency bottlenecks in Clojure code
Measure only when it is hot
Garbage collection bottlenecks
Threads waiting at GC safepoint
Using jstat to probe GC details
Inspecting generated bytecode for Clojure source
Throughput bottlenecks
Profiling code with VisualVM
The Monitor tab
The Threads tab
The Sampler tab
Setting the thread name
The Profiler tab
The Visual GC tab
The Alternate profilers
Performance tuning
Tuning Clojure code
CPU/cache bound
Memory bound
Multi-threaded
I/O bound
JVM tuning
Back pressure
Summary
8. Application Performance
Choosing libraries
Making a choice via benchmarks
Web servers
Web routing libraries
Data serialization
JSON serialization
JDBC
Logging
Why SLF4J/LogBack?
The setup
Dependencies
The logback configuration file
Optimization
Data sizing
Reduced serialization
Chunking to reduce memory pressure
Sizing for file/network operations
Sizing for JDBC query results
Resource pooling
JDBC resource pooling
I/O batching and throttling
JDBC batch operations
Batch support at API level
Throttling requests to services
Precomputing and caching
Concurrent pipelines
Distributed pipelines
Applying back pressure
Thread pool queues
Servlet containers such as Tomcat and Jetty
HTTP Kit
Aleph
Performance and queueing theory
Little's law
Performance tuning with respect to Little's law
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜