All Projects → codahale → Usl4j

codahale / Usl4j

Licence: apache-2.0
A reasonably complete implementation of the Universal Scalability Law model.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Usl4j

Cs Fundamentals
The CS Fundamentals Series
Stars: ✭ 76 (-60.82%)
Mutual labels:  scalability
Hazelcast Nodejs Client
Hazelcast IMDG Node.js Client
Stars: ✭ 124 (-36.08%)
Mutual labels:  scalability
Sitereliabilityengineering
Notes on Site Reliability Engineering. Leave a 🌟 if you found this useful!
Stars: ✭ 144 (-25.77%)
Mutual labels:  scalability
Hazelcast Python Client
Hazelcast IMDG Python Client
Stars: ✭ 92 (-52.58%)
Mutual labels:  scalability
Deephyper
DeepHyper: Scalable Asynchronous Neural Architecture and Hyperparameter Search for Deep Neural Networks
Stars: ✭ 117 (-39.69%)
Mutual labels:  scalability
Imhotep
Imhotep is a large-scale analytics platform built by Indeed.
Stars: ✭ 125 (-35.57%)
Mutual labels:  scalability
Socialize Friendships
A Meteor package for creating friendship functionality within your app.
Stars: ✭ 44 (-77.32%)
Mutual labels:  scalability
Sparse Evolutionary Artificial Neural Networks
Always sparse. Never dense. But never say never. A repository for the Adaptive Sparse Connectivity concept and its algorithmic instantiation, i.e. Sparse Evolutionary Training, to boost Deep Learning scalability on various aspects (e.g. memory and computational time efficiency, representation and generalization power).
Stars: ✭ 182 (-6.19%)
Mutual labels:  scalability
Tuist
🚀 Create, maintain, and interact with Xcode projects at scale
Stars: ✭ 2,234 (+1051.55%)
Mutual labels:  scalability
Hazelcast Go Client
Hazelcast IMDG Go Client
Stars: ✭ 140 (-27.84%)
Mutual labels:  scalability
Limes
Link Discovery Framework for Metric Spaces.
Stars: ✭ 94 (-51.55%)
Mutual labels:  scalability
Jedaitoolkit
An open source, high scalability toolkit in Java for Entity Resolution.
Stars: ✭ 115 (-40.72%)
Mutual labels:  scalability
Contracts
Smart contracts comprising the business logic of the Matic Network
Stars: ✭ 130 (-32.99%)
Mutual labels:  scalability
React Redux Saucepan
A minimal and universal react redux starter project. With hot reloading, linting and server-side rendering
Stars: ✭ 86 (-55.67%)
Mutual labels:  scalability
Openpmix
OpenPMIx Project Repository
Stars: ✭ 151 (-22.16%)
Mutual labels:  scalability
Hazelcast Cpp Client
Hazelcast IMDG C++ Client
Stars: ✭ 67 (-65.46%)
Mutual labels:  scalability
Mioco
[no longer maintained] Scalable, coroutine-based, fibers/green-threads for Rust. (aka MIO COroutines).
Stars: ✭ 125 (-35.57%)
Mutual labels:  scalability
Azuredatabricksbestpractices
Version 1 of Technical Best Practices of Azure Databricks based on real world Customer and Technical SME inputs
Stars: ✭ 186 (-4.12%)
Mutual labels:  scalability
Cote
A Node.js library for building zero-configuration microservices.
Stars: ✭ 2,180 (+1023.71%)
Mutual labels:  scalability
Vertx In Action
Examples for the Manning "Vert.x in Action" book
Stars: ✭ 134 (-30.93%)
Mutual labels:  scalability

usl4j

CircleCI

usl4j is Java modeler for Dr. Neil Gunther's Universal Scalability Law as described by Baron Schwartz in his book Practical Scalability Analysis with the Universal Scalability Law.

Given a handful of measurements of any two Little's Law parameters--throughput, latency, and concurrency--the USL allows you to make predictions about any of those parameters' values given an arbitrary value for any another parameter. For example, given a set of measurements of concurrency and throughput, the USL will allow you to predict what a system's average latency will look like at a particular throughput, or how many servers you'll need to process requests and stay under your SLA's latency requirements.

The model coefficients and predictions should be within 0.02% of those listed in the book.

Add to your project

<dependency>
  <groupId>com.codahale</groupId>
  <artifactId>usl4j</artifactId>
  <version>0.7.0</version>
</dependency>

It depends on DDogleg Numerics for least-squares regression.

Note: module name for Java 9+ is com.codahale.usl4j.

How to use this

As an example, consider doing load testing and capacity planning for an HTTP server. To model the behavior of the system using the USL, you must first gather a set of measurements of the system. These measurements must be of two of the three parameters of Little's Law: mean response time (in seconds), throughput (in requests per second), and concurrency (i.e. the number of concurrent clients).

Because response time tends to be a property of load (i.e. it rises as throughput or concurrency rises), the dependent variable in your tests should be mean response time. This leaves either throughput or concurrency as your independent variable, but thanks to Little's Law it doesn't matter which one you use. For the purposes of discussion, let's say you measure throughput as a function of the number of concurrent clients working at a fixed rate (e.g. you used wrk2).

After your load testing is done, you should have a set of measurements shaped like this:

concurrency throughput
1 955.16
2 1878.91
3 2688.01
4 3548.68
5 4315.54
6 5130.43
7 5931.37
8 6531.08

For simplicity's sake, let's assume you're storing this as a double[][]. Now you can build a model and begin estimating things:

import com.codahale.usl4j.Measurement;
import com.codahale.usl4j.Model;
import java.util.Arrays;

class Example {
  void buildModel() {
    final double[][] points = {{1, 955.16}, {2, 1878.91}, {3, 2688.01}}; // etc.
  
    // Map the points to measurements of concurrency and throughput, then build a model from them. 
    final Model model = Arrays.stream(points)
                              .map(Measurement.ofConcurrency()::andThroughput)
                              .collect(Model.toModel());
    for (int i = 10; i < 200; i+=10) {
      System.out.printf("At %d workers, expect %f req/sec\n", i, model.throughputAtConcurrency(i));
    }
  }
}

Performance

Building models is pretty fast:

Benchmark         (size)  Mode  Cnt   Score   Error  Units
Benchmarks.build      10  avgt    5   0.507 ± 0.061  us/op
Benchmarks.build     100  avgt    5   1.242 ± 0.266  us/op
Benchmarks.build    1000  avgt    5   7.499 ± 0.157  us/op
Benchmarks.build   10000  avgt    5  72.321 ± 2.681  us/op

Further reading

I strongly recommend Practical Scalability Analysis with the Universal Scalability Law, a free e-book by Baron Schwartz, author of High Performance MySQL and CEO of VividCortex. Trying to use this library without actually understanding the concepts behind Little's Law, Amdahl's Law, and the Universal Scalability Law will be difficult and potentially misleading.

I also wrote a blog post about this library.

License

Copyright © 2017 Coda Hale

Distributed under the Apache License 2.0.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].