1
Fork 0

stage2: update README

main
Motiejus Jakštys 2023-02-08 16:40:39 +02:00
parent 000080a781
commit 345c38eb61
1 changed files with 22 additions and 15 deletions

View File

@ -12,10 +12,10 @@ for environments that have a central user & group database which then needs to
be distributed to many servers/services, and the data does not change very
often (e.g. hourly).
This is the fastest known NSS passwd/group implementation for *reads*. On a
corpus with 10k users, 10k groups and 500 average members per group, `id` takes
17 seconds with the glibc default implementation, 10-17 milliseconds with a
pre-cached `nscd`, ~8 milliseconds with `turbonss`.
This is the fastest known NSS passwd/group implementation for *reads*. On my
2018-era laptop a corpus with 10k users, 10k groups and 500 average members per
group, `id` takes 17 seconds with the glibc default implementation, 10-17
milliseconds with a pre-cached `nscd`, ~8 milliseconds with `turbonss`.
Project status
--------------
@ -28,11 +28,17 @@ the hoops of using a nonstandard nss library in the first place.
Yours truly worked on this for about 7 months. This was also my first zig
project which I never went to (nor really needed to) come back and clean up.
Update 2022-02: I am reviving it:
- updated to stage2, so it works on nightly again.
- I learned some zig over the last year, will be cleaning it up.
Currently it has not been fuzz-tested, so it will crash on invalid data. Please
use `ReleaseSafe` until it is fuzzed.
Dependencies
------------
1. zig v0.10. turbonss is implemented in stage1, so will not work with zig
v0.11+.
1. zig 0.11.0-dev.1580+a5b34a61a or higher.
2. [cmph][cmph]: bundled with this repository.
Trying it out
@ -42,25 +48,23 @@ Clone, compile and test first:
$ git clone --recursive https://git.sr.ht/~motiejus/turbonss
$ zig build test
$ zig build -Dtarget=x86_64-linux-gnu.2.16 -Dcpu=baseline -Drelease-safe=true
$ zig build -Dtarget=x86_64-linux-gnu.2.16 -Dcpu=baseline -Doptimize=ReleaseSafe
One may choose different options, depending on requirements. Here are some
hints:
1. `-Dcpu=<...>` for the CPU
[microarchitecture](https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels).
2. `-Drelease-fast=true` for max speed
3. `-Drelease-small=true` for smallest binary sizes.
4. `-Dstrip=true` to strip debug symbols.
2. `-Dstrip=true` to strip debug symbols.
For reference, size of the shared library and helper binaries when compiled
with `-Dstrip=true -Drelease-small=true`:
17K Nov 30 11:53 turbonss-analyze
16K Nov 30 11:53 turbonss-getent
17K Nov 30 11:53 turbonss-makecorpus
166K Nov 30 11:53 turbonss-unix2db
22K Nov 30 11:53 libnss_turbo.so.2.0.0
28K zig-out/bin/turbonss-analyze
20K zig-out/bin/turbonss-getent
24K zig-out/bin/turbonss-makecorpus
140K zig-out/bin/turbonss-unix2db
24K zig-out/lib/libnss_turbo.so.2.0.0
Many thanks to Ulrich Drepper for [teaching how to link it properly][dso].
@ -158,6 +162,9 @@ by 10x (to 100k each), the difference becomes even crazier:
user 0m0.000s
sys 0m0.008s
Note that to author's knowledge this has not been used on any real production
nor a development machine.
Documentation
-------------