All Projects → cristalhq → hedgedhttp

cristalhq / hedgedhttp

Licence: MIT license
Hedged HTTP client which helps to reduce tail latency at scale.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to hedgedhttp

Dgraph
Native GraphQL Database with graph backend
Stars: ✭ 17,127 (+16528.16%)
Mutual labels:  scale, latency
spicedb
Open Source, Google Zanzibar-inspired fine-grained permissions database
Stars: ✭ 3,358 (+3160.19%)
Mutual labels:  scale, latency
EthernetWebServer SSL
Simple TLS/SSL Ethernet WebServer, HTTP Client and WebSocket Client library for for AVR, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52 and RASPBERRY_PI_PICO boards using Ethernet shields W5100, W5200, W5500, ENC28J60 or Teensy 4.1 NativeEthernet/QNEthernet. It now supports Ethernet TLS/SSL Client. The library supports …
Stars: ✭ 40 (-61.17%)
Mutual labels:  http-client
sugar
Declarative HTTP client for Golang
Stars: ✭ 25 (-75.73%)
Mutual labels:  http-client
pawn-requests
pawn-requests provides an API for interacting with HTTP(S) JSON APIs.
Stars: ✭ 56 (-45.63%)
Mutual labels:  http-client
Rump
REST client for Java that allows for easy configuration and default values. Allows for quick request construction and a huge range of modifications by using response/request interceptors, adjusting default values related to HTTP requests and creating custom instances for when you need multiple API connection setups.
Stars: ✭ 55 (-46.6%)
Mutual labels:  http-client
simplehttp
HTTP client for Elixir without dependencies
Stars: ✭ 16 (-84.47%)
Mutual labels:  http-client
Plezi
Plezi - the Ruby framework for realtime web-apps, websockets and RESTful HTTP
Stars: ✭ 239 (+132.04%)
Mutual labels:  scale
matador
Take your appclication by the horns
Stars: ✭ 59 (-42.72%)
Mutual labels:  http-client
nitroml
NitroML is a modular, portable, and scalable model-quality benchmarking framework for Machine Learning and Automated Machine Learning (AutoML) pipelines.
Stars: ✭ 40 (-61.17%)
Mutual labels:  scale
ASV
[CVPR16] Accumulated Stability Voting: A Robust Descriptor from Descriptors of Multiple Scales
Stars: ✭ 26 (-74.76%)
Mutual labels:  scale
BetterDummy
Unlock your displays on your Mac! Smooth scaling, HiDPI unlock, XDR/HDR extra brightness upscale, DDC, brightness and dimming, dummy displays, PIP and lots more!
Stars: ✭ 9,601 (+9221.36%)
Mutual labels:  scale
scale
📦 Toolkit for mapping abstract data into visual representation.
Stars: ✭ 53 (-48.54%)
Mutual labels:  scale
typesense-dart
Dart client for Typesense
Stars: ✭ 50 (-51.46%)
Mutual labels:  http-client
go-sse
Fully featured, spec-compliant HTML5 server-sent events library
Stars: ✭ 165 (+60.19%)
Mutual labels:  http-client
cpphttpstack
c++ api for http client & server
Stars: ✭ 30 (-70.87%)
Mutual labels:  http-client
http
ponylang HTTP client library 🐴 🕸️
Stars: ✭ 38 (-63.11%)
Mutual labels:  http-client
hackernews
📰 HackerNews API
Stars: ✭ 40 (-61.17%)
Mutual labels:  http-client
android-http-client
Simple and lightweight HTTP client for Android
Stars: ✭ 13 (-87.38%)
Mutual labels:  http-client
direwolf
Package direwolf is a convenient and easy to use http client written in Golang.
Stars: ✭ 44 (-57.28%)
Mutual labels:  http-client

hedgedhttp

build-img pkg-img reportcard-img coverage-img version-img

Hedged HTTP client which helps to reduce tail latency at scale.

Rationale

See paper Tail at Scale by Jeffrey Dean, Luiz André Barroso. In short: the client first sends one request, but then sends an additional request after a timeout if the previous hasn't returned an answer in the expected time. The client cancels remaining requests once the first result is received.

Acknowledge

Thanks to Bohdan Storozhuk for the review and powerful hints.

Features

  • Simple API.
  • Easy to integrate.
  • Optimized for speed.
  • Clean and tested code.
  • Supports http.Client and http.RoundTripper.
  • Dependency-free.

Install

Go version 1.16+

go get github.com/cristalhq/hedgedhttp

Example

ctx := context.Background()
req, err := http.NewRequestWithContext(ctx, http.MethodGet, "https://google.com", http.NoBody)
if err != nil {
	panic(err)
}

timeout := 10 * time.Millisecond
upto := 7
client := &http.Client{Timeout: time.Second}
hedged, err := hedgedhttp.NewClient(timeout, upto, client)
if err != nil {
	panic(err)
}

// will take `upto` requests, with a `timeout` delay between them
resp, err := hedged.Do(req)
if err != nil {
	panic(err)
}
defer resp.Body.Close()

Also see examples: examples_test.go.

Documentation

See these docs.

License

MIT License.

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].