สารบัญ:
- คู่มือและตัวอย่าง
- การติดตั้งและคำถามที่พบบ่อย
- คุณสมบัติและมาตรฐาน
- เกี่ยวกับลิขสิทธิ์และการออกใบอนุญาต SBOM และการอ้างอิง
- แชทเกี่ยวกับ Discord พูดคุยเกี่ยวกับ GitHub หรือผู้เขียนอีเมล
kawipiko
is a lightweight static HTTP server written in Go; focused on serving static content as fast and efficient as possible , with the lowest latency , and with the lowest resource consumption (either CPU, RAM, IO); supporting both HTTP/1 (with or without TLS), HTTP/2 and HTTP/3 (over QUIC) ; available as a single statically linked executable without any other dependencies.
Want to see kawipiko
in action?
/documentation
represents static sites that compress well, meanwhile /carina-nebula
, /openstreetmap
and /fontawesome
represents static sites that generate lots of small requests; (โปรดทราบว่าอินสแตนซ์นี้อยู่เบื้องหลัง CloudFlare อย่างไรก็ตามมันได้รับคำสั่งไม่ให้แคชอะไรบนขอบ;) (เซิร์ฟเวอร์ถูกโฮสต์ผ่านการเชื่อมต่อไฟเบอร์ที่อยู่อาศัย;) However, simple doesn't imply dumb or limited , instead it implies efficient through the removal of superfluous features, thus being inline with UNIX's old philosophy of "do one thing and do it well". Therefore, it supports only GET
requests, and does not provide features like dynamic content generation, authentication, reverse proxying, etc.; meanwhile still providing compression ( gzip
, zopfli
, or brotli
), plus HTML-CSS-JS minifying (TODO), without affecting its performance (due to its unique architecture as described below).
What kawipiko
does provide is something very unique, that no other HTTP server offers: the static content is served from a CDB file with almost no latency (as compared to classical static servers that still have to pass through the OS via the open-read-close
syscalls). ยิ่งไปกว่านั้นตามที่ระบุไว้ก่อนหน้านี้เนื้อหาคงที่ยังคงสามารถบีบอัดหรือลดลงได้ก่อนเวลาซึ่งจะลดไม่เพียง แต่ CPU แต่ยังรวมถึงแบนด์วิดท์และเวลาแฝง
ไฟล์ CDB เป็นไฟล์ฐานข้อมูลไบนารีที่ให้ตารางการค้นหาค่าคีย์แบบอ่านอย่างเดียวอย่างมีประสิทธิภาพซึ่งเริ่มแรกใช้ในเซิร์ฟเวอร์ DNS และ SMTP บางตัวส่วนใหญ่สำหรับการดำเนินการค้นหาค่าใช้จ่ายต่ำมาก "การอัปเดตหลายบันทึก นอกจากนี้ยังทำให้พวกเขาเหมาะสำหรับเนื้อหาคงที่ความล่าช้าต่ำที่ให้บริการผ่าน HTTP ซึ่งเป็นสิ่งที่โครงการนี้จัดเตรียมไว้
For those familiar with Netlify (or competitors like CloudFlare Pages, GitHub Pages, etc.), kawipiko
is a host-it-yourself alternative featuring:
chroot
it, or containerize it as is in fashion these days;)สำหรับรายการคุณสมบัติที่สมบูรณ์โปรดปรึกษาส่วนคุณสมบัติ น่าเสียดายที่มีการแลกเปลี่ยนบางอย่างตามที่อธิบายไว้ในส่วนข้อ จำกัด (แม้ว่าจะไม่มีความสำคัญ)
With regard to performance, as described in the benchmarks section, kawipiko
is at least on-par with NGinx, sustaining over 100K requests / second with 0.25ms latency for 99% of the requests even on my 6 years old laptop. อย่างไรก็ตามข้อได้เปรียบหลักของ NGINX ไม่ใช่ประสิทธิภาพดิบ แต่การปรับใช้และความเรียบง่ายการกำหนดค่ารวมถึงการจัดการที่มีประสิทธิภาพและการจัดเก็บคอลเลกชันขนาดใหญ่ของไฟล์ขนาดเล็กจำนวนมาก
In relation to kawipiko
I've also published a few articles on my own site:
seccomp
syscall filtering to improve the security by reducing the attack surface;kawipiko
;)โครงการจัดทำหน้าที่เรียกใช้งานต่อไปนี้ (เชื่อมโยงแบบคงที่โดยไม่มีการพึ่งพาอื่น ๆ ):
kawipiko-server
-- which serves the static content from the CDB archive either via HTTP (with or without TLS), HTTP/2 or HTTP/3 (over QUIC);kawipiko-archiver
-- which creates the CDB archive from a source folder holding the static content, optionally compressing and minifying files;kawipiko
-- an all-in-one executable that bundles all functionality in one executable; (ie kawipiko server ...
or kawipiko archiver ...
); Unlike most (if not all) other servers out-there, in which you just point your web server to the folder holding the static website content root, kawipiko
takes a radically different approach: in order to serve the static content, one has to first archive the content into the CDB archive through kawipiko-archiver
, and then one can serve it from the CDB archive through kawipiko-server
.
ขั้นตอนสองขั้นตอนนี้ยังมีโอกาสน้อยเช่นกัน:
zopfli
or brotli
), to trade CPU during deployment vs latency and bandwidth at runtime. ดูคู่มือเฉพาะ
เอกสารนี้ยังมีอยู่ในข้อความธรรมดาหรือเป็นหน้าผู้ชาย
ดูคู่มือเฉพาะ
เอกสารนี้ยังมีอยู่ในข้อความธรรมดาหรือเป็นหน้าผู้ชาย
ดึงและแยกเอกสาร Python 3.10 HTML Archive:
ขด -s -s -f -o ./python-3.10.1-docs-html.tar.bz2 https://docs.python.org/3/archives/python-3.10.1-docs-html.tar.bz2 - ทาร์ -x -j -v -f ./python-3.10.1-docs-html.tar.bz2 -
สร้าง CDB เก็บถาวร (โดยไม่มีการบีบอัด):
Kawipiko-archiver -archive ./python-3.10.1-docs-html-nocomp.cdb -แหล่งที่มา/python-3.10.1-docs-html -debug -
create the CDB archive (with gzip
compression):
Kawipiko-archiver -archive ./python-3.10.1-docs-html-gzip.cdb -แหล่งที่มา/python-3.10.1-docs-html -compress gzip -debug -
create the CDB archive (with zopfli
compression):
Kawipiko-archiver -archive ./python-3.10.1-docs-html-zopfli.cdb -แหล่งที่มา/python-3.10.1-docs-html -compress zopfli -debug -
create the CDB archive (with brotli
compression):
Kawipiko-archiver -archive ./python-3.10.1-docs-html-brotli.cdb -แหล่งที่มา/python-3.10.1-docs-html -บีบอัด brotli -debug -
serve the CDB archive (with gzip
compression):
Kawipiko-Server --bind 127.0.0.1:8080 -archive ./python-3.10.1-docs-html-gzip.cdb -archive-mmap -Archive-Preload -debug -
เปรียบเทียบแหล่งที่มาและขนาดเก็บถาวร:
du -h -s - ./python-3.10.1-docs-html-nocomp.cdb ./python-3.10.1-docs-html-gzip.cdb ./python-3.10.1-docs-html-zopfli.cdb ./python-3.10.1-docs-html-brotli.cdb - ./python-3.10.1-docs-html ./python-3.10.1-docs-html.tar.bz2 - 45m ./python-3.10.1-docs-html-nocomp.cdb 9.7m ./python-3.10.1-docs-html-gzip.cdb - ./python-3.10.1-docs-html-zopfli.cdb 7.9m ./python-3.10.1-docs-html-brotli.cdb 46m ./python-3.10.1-docs-html 6.0m ./python-3.10.1-docs-html.tar.bz2
ดูเอกสารการติดตั้งเฉพาะ
ต่อไปนี้เป็นรายการของคุณสมบัติที่สำคัญที่สุด:
gzip
, zopfli
or brotli
;mmap
); การซื้อขายหน่วยความจำสำหรับ CPU;rename
syscall (or the mv
tool), all served resources are observed to change at the same time;_wildcard.*
files (where .*
are the regular extensions like .txt
, .html
, etc.) which will be used if an actual resource is not found under that folder; (ไฟล์เหล่านี้เกี่ยวข้องกับโครงสร้างต้นไม้แบบลำดับชั้นคือ "ลึก" ไฟล์แทนที่ไฟล์ที่อยู่ใกล้กับ "รูท";)github.com/valyala/fasthttp
;net/http
;github.com/lucas-clemente/quic-go
; ต่อไปนี้เป็นรายการของคุณสมบัติที่สำคัญที่สุดที่ขาดหายไปในปัจจุบันและมีการวางแผนที่จะนำไปใช้:
Content-Type
, Content-Length
, Content-Encoding
are included; additionally Cache-Control: public, immutable, max-age=3600
, optionally ETag
, and a few TLS or security related headers can also be included;)Host
header, is supported by the server, and partially by the archiver;)https://github.com/tdewolff/minify
;404
wildcards are supported;) ตามที่ระบุไว้ในส่วนเกี่ยวกับไม่มีอะไรมาฟรีและเพื่อให้คุณสมบัติทั้งหมดเหล่านี้ต้องตัดบางมุม:
brotli
), the server will serve all resources compressed (ie Content-Encoding: brotli
), regardless of what the browser accepts (ie Accept-Encoding: gzip
); เช่นเดียวกับเนื้อหาที่ไม่มีการบีบอัด (however always using gzip
compression is safe enough, as it is implemented in virtually all browsers and HTTP clients out there;)ดูเอกสารมาตรฐานเฉพาะ
หากคุณพบข้อผิดพลาดเพียงแค่ใช้ปัญหา GitHub
หากคุณไม่แน่ใจเกี่ยวกับบางสิ่งบางอย่างต้องการให้ข้อเสนอแนะหรือขอคุณสมบัติใหม่เพียงใช้การอภิปราย GitHub
หากคุณต้องการถามคำถามสั้น ๆ หรือเพียงแค่มีการแชทอย่างรวดเร็วเพียงแค่ตรงไปที่ช่อง Discord
ใช่ปัจจุบันกำลังให้บริการหน้า ~ 600k html
แม้ว่าการเป็นโอเพ่นซอร์สคุณมีความรับผิดชอบในการตรวจสอบให้แน่ใจว่ามันทำงานภายในความต้องการของคุณ!
อย่างไรก็ตามฉันพร้อมสำหรับการให้คำปรึกษาเกี่ยวกับการปรับใช้และการใช้งาน -
CDB เป็นฐานข้อมูลฝังคีย์-ค่าที่น่าเคารพนับถือซึ่งดำเนินการโดย DJ Bernstein, https://cr.yp.to/cdb.html และใช้ในโซลูชันซอฟต์แวร์หลายอย่างที่เขาใช้โดย QMail และ TinyDns ที่โดดเด่นที่สุด จากนั้นมันก็ถูกหยิบขึ้นมาโดยบริการเครือข่ายอื่น ๆ ที่ต้องใช้ตารางการค้นหาต่ำที่ไม่ได้รับการดูแลแบบคงที่ส่วนใหญ่เช่น postfix เป็นทางเลือกสำหรับฐานข้อมูลผู้ใช้
จนกว่าฉันจะขยายสาเหตุที่ฉันเลือกใช้ CDB สำหรับเนื้อหาเว็บไซต์แบบคงที่บริการคุณสามารถอ่านเกี่ยวกับ Sparkey จาก Spotify
การใช้งาน CDB ที่ใช้เป็นส้อมแบบกำหนดเองของสิ่งต่อไปนี้:
เนื่องจาก GO นั้นมีความสามารถสูงมีความเสถียรสูงและโดยเฉพาะอย่างยิ่งเนื่องจากสามารถรองรับไบรท์ที่เชื่อมโยงข้ามแบบสัดส่วนกับแพลตฟอร์มใด ๆ ที่รองรับได้อย่างง่ายดาย
เนื่องจาก Rust ล้มเหลวในการรองรับการทำงานข้าม (แบบคงที่หรือเชื่อมโยงแบบไดนามิก) ได้อย่างง่ายดายไปยังแพลตฟอร์มใด ๆ ที่รองรับ
เพราะสนิมพกพาน้อยกว่าไป ตัวอย่างเช่น Rust ไม่ได้พิจารณา OpenBSD เป็นแพลตฟอร์ม "Tier-1"
โปรดดู SBOM (Software Bill of Materials) สำหรับลิงก์การพึ่งพาของโครงการนี้และผู้แต่ง
รหัสได้รับอนุญาตภายใต้ AGPL 3 หรือใหม่กว่า
If you change the code within this repository and use it for non-personal purposes, you'll have to release it as per AGPL.
สำหรับรายละเอียดเกี่ยวกับลิขสิทธิ์และการออกใบอนุญาตโปรดปรึกษาไฟล์ประกาศในโฟลเดอร์เอกสาร/ใบอนุญาต
หากมีคนต้องการแหล่งที่มาและ/หรือเอกสารประกอบภายใต้ใบอนุญาตอื่นโปรดส่งอีเมลไปยังผู้เขียนโดยระบุข้อกำหนดการออกใบอนุญาตพร้อมด้วยเหตุผลและรายละเอียดอื่น ๆ จากนั้นขึ้นอยู่กับสถานการณ์ผู้เขียนอาจปล่อยแหล่งที่มาและ/หรือเอกสารประกอบภายใต้ใบอนุญาตอื่น
โครงการนี้เช่นเดียวกับโครงการโอเพนซอร์ซอื่น ๆ รวมรหัสจากโครงการโอเพนซอร์ซอื่น ๆ (นอกเหนือจากเครื่องมืออื่น ๆ ที่ใช้ในการพัฒนาสร้างและทดสอบ)
เกี่ยวข้องอย่างเคร่งครัดกับการพึ่งพาของโครงการ (โดยตรงและสกรรมกริยา) โปรดดู SBOM (Bill of Materials Software) สำหรับลิงก์ไปยังการพึ่งพาเหล่านี้และใบอนุญาต
ดูเอกสารอ้างอิงเฉพาะ