• Stars
    star
    344
  • Rank 118,393 (Top 3 %)
  • Language
    Scala
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Blazing fast NIO microframework and Http Parser

blaze Continuous Integration Maven Central

blaze is a Scala library for building asynchronous pipelines, with a focus on network IO. Blaze is the original server and client backend for the http4s project.

Modules

blaze was conceived as a standalone project, but has seen the most use through http4s. This repository houses both the standalone modules and the http4s backend.

Standalone modules

These have minimal external dependencies. They represent the original vision of the blaze project and are less functional in nature.

http4s backend

These modules were housed in the http4s repository through v0.23.11. They are now maintained alongside the blaze core. These modules depend on http4s-core and blaze-http.

Features

  • Completely asynchronous, pull-based design
  • Type safe pipeline composition
  • NIO1 and NIO2 socket engines
  • SSL integration
  • HTTP/1.x and HTTP/2 codecs
  • Basic HTTP/1.x server and client
  • Basic HTTP/2 server

blaze's goals are

  • Provides an IO framework to support the core http4s project
  • Speed is the first priority
  • Asynchronicity underpinned by Scala Future
  • Java NIO backend for fast/asynchronous network and file I/O
  • A framework for rapid development of fast, asynchronous pipelines using Scala

What blaze is not

  • Purely functional. Functional is preferred except when in conflict with the first goal.

Asynchronous network I/O

blaze was built with NIO2 features in mind. NIO2 offers a host of new features which are offered in a unified way. blaze offers TCP socket server support for both NIO1 and NIO2, depending on your preference. NIO1 tends to be the better performing technology for raw sockets.

Getting started

For a quick start, look in the examples project for some simple examples of HTTP, WebSocket, and a simple EchoServer.

Important blaze behaviors

  • By default, read and write requests should be serialized either manually, or with a SerializerStage.

Data flow

Useful asynchronous processing is done through the construction of a pipeline. A pipeline is composed of individual stages that perform operations such as decoding/encoding, SSL encryption, buffering, etc. The pipeline is constructed in a type safe manner using the PipelineBuilder types.

blaze is a pull-based framework as opposed to the reactor and actor models found in other systems. Therefore, data flow is typically controlled by the tail of the pipeline. Data is written and requested using the Future type found in the Scala standard library.

blaze doesn't make any assumptions as to whether any stage is threadsafe, so as noted above, either manually ensure a write is not performed before the previous write has completed and the same for reads, or use a SerializerStage or Serializer mixin to automatically sequence reads and writes for you.

Contributors

The Contributors, as calculated by GitHub. Contributions and comments in the form of issues or pull requests are greatly appreciated.

Acknowledgments

Several concepts are inspired by the Jetty and Netty projects.

Licence

Blaze is licensed under the Apache 2 license. See the LICENSE file in the root project directory for more information.

More Repositories

1

http4s

A minimal, idiomatic Scala interface for HTTP
Scala
2,503
star
2

rho

A self documenting DSL built on http4s
Scala
289
star
3

http4s.g8

giter8 template for bootstrapping http4s services
Scala
104
star
4

http4s-armeria

Armeria backend for http4s
Scala
59
star
5

http4s-jdk-http-client

JDK 11+ http client implementation for http4s clients
Scala
55
star
6

http4s-netty

Http4s on pure netty
Scala
40
star
7

http4s-curl

curling isn't just for Canadians
Scala
32
star
8

http4s-dom

http4s, in a browser near you
Scala
26
star
9

http4s_demo

See how easy http4s makes life
JavaScript
14
star
10

http4s-finagle

Http4s on Finagle Server or Client
Scala
11
star
11

http4s-websocket

Common websocket support for blaze and http4s-servlet
Scala
9
star
12

sbt-http4s-org

An experimental SBT plugin to support various http4s projects
Scala
9
star
13

http4s-io.g8

An alternate giter8 template fixed on IO
Scala
9
star
14

http4s-session

Http4s Session Convenience
Scala
8
star
15

http4s-prometheus-metrics

Support for Prometheus Metrics
Scala
8
star
16

http4s-fs2-data

http4s integration with fs2-data
Scala
7
star
17

http4s-crypto

Incubator for cryptographic functions cross-built for the JVM and Scala.js.
Scala
7
star
18

http4s-servlet

http4s-servlet support
Scala
5
star
19

http4s-scalatags

Scalatags template support for http4s
Scala
5
star
20

http4s-twirl

Twirl template support for http4s
Scala
4
star
21

http4s-jetty

Jetty backend for http4s servers
Scala
4
star
22

http4s-scala-xml

http4s codecs for scala-xml
Scala
4
star
23

http4s-fabric

Fabric integration module for http4s
Scala
4
star
24

http4s-play-json

Play JSON codecs for http4s
Scala
3
star
25

http4s-monadic-dsl

Scala
3
star
26

hpack

Header Compression for HTTP/2
Scala
2
star
27

http4s-okhttp-client

okhttp implementation for http4s clients
Scala
1
star
28

http4s-tomcat

Apache Tomcat backend for http4s
Scala
1
star