ktorio / ktorio/ktor

Consider caching file attributes for static content

Open
#369 5 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
14.5k
Forks
1.3k
Avg merge
2d 13h
Merged PRs (30d)
49

Description

On simple static workload
```
static("static") {
file("js/script.js")
}
```
caching result of `file.isFile` invocation saves up to 30% of throughput (depending on file size).
For static content it can be cached either forever or in timely manner (e.g. via Guava's `Suppliers#memoizeWithExpiration`).
The rest of attributes (byte content or last modified time required for `LocalFileContent#`) can probably be cached as well

Contributor guide

Open the contributing guide

Research direction

Start by tracing the static("static") file("js/script.js") path and the file.isFile invocation, then inspect LocalFileContent initialization and its byte-content and last-modified requirements. Measure the simple static workload before and after caching; done means improved throughput without stale or incorrect file attributes.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
backend, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.