Tremolo Under The Hood #41
nggit
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Stream-oriented
Streaming is a key approach at Tremolo. Both in the request and response area.
On Request,
request.read()
or request.stream() will receive and decode chunked encoding on-the-fly!Not only that,
request.files()
parsesmultipart/form-data
lazily and you will receive the uploaded files one by one, a.k.a. multipart streaming.It doesn't wait for the whole body to arrive and then parse it with
files = body.split(boundary)
, like some frameworks do.That makes parsing easier but in a horrible way.
Slim codebase
Tremolo emphasizes the elegance of design.
-- Dennis Ritchie and Ken Thompson
This is subjective, but this will be a major concern in development. We will always try to remove rather than add something.
Simpler means fewer bugs and attack surfaces.
Regex is a sin
We don't rely on regex in the code. The only sin we commit is that our routing is powered by regex.
Not that we hate it. Regex is too powerful and may have unpredictable costs; security, maintainability.
Utilizes few asyncio APIs/methods
Tremolo is only built using a few asyncio paradigms.
Mostly from the low-level API category like
loop.create_future()
,loop.create_task()
,loop.call_at()
and a few from the high-level API likeasyncio.sleep()
.This has several benefits:
Resilient
Tremolo is small, but designed to withstand heavy loads. Workers will restart if killed, etc.
We wanted a reliable server with zero maintenance.
Beta Was this translation helpful? Give feedback.
All reactions