ktorio / ktor

Framework for quickly creating connected applications in Kotlin with minimal effort
https://ktor.io
Apache License 2.0
12.97k stars 1.06k forks source link

Consider caching file attributes for static content #369

Open qwwdfsad opened 6 years ago

qwwdfsad commented 6 years ago

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#<init>) can probably be cached as well

orangy commented 6 years ago

Caching of file data is planned, we need to adopt something like https://github.com/ben-manes/caffeine for the best multithreading throughput and async cache fills.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity.

oleg-larshin commented 4 years ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.