[{"data":1,"prerenderedAt":376},["ShallowReactive",2],{"project-20081488":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":35,"aspects":36,"strip":43,"post_text":45,"what":46,"said":73,"maker_in_thread":190,"shape":202,"grid":205,"attempts":338,"same_week":339,"maker_shows":31,"maker_hidden":368,"reader_version":369,"card":370},"20081488","ZeroHTTPd","A web server to teach Linux performance, with benchmarks","title","Show HN: ZeroHTTPd: A web server to teach Linux performance, with benchmarks","https:\u002F\u002Funixism.net\u002F2019\u002F04\u002Flinux-applications-performance-introduction\u002F","unixism.net","shuss",1559552206,2019,472,57,38,2195,2,"legend","learning_science","teaching material for server architectures","other",[24,25,26,27],"linux performance","epoll","web server","http benchmark","curious",-0.044,{"positive":31,"neutral":32,"mixed":33,"critical":34},4,13,0,7,24,{"execution":37,"docs":38,"performance":40,"idea":42},{"positive":33,"critical":18},{"positive":39,"critical":33},1,{"positive":39,"critical":41},3,{"positive":39,"critical":18},[39,33,41,33,33,33,41,44,41,41,41,41,33,41,39,33,33,33,39,33,33,41,41,44,33,44,33,44,41,33,41,33,39,33,41,33,33,39,33,39],5,null,{"problem":47,"audience":45,"pricing":45,"motivation":54,"time_to_build":45,"stack":58,"openness":71,"stage":72,"team_size":71},{"value":48,"source":49,"evidence":50},"Shows how different Linux server architectures are written and how they perform","maker",[51],{"id":52,"by":11,"text":53},"20082166","As mentioned in the first part of the series, the main idea is to compare and contrast Linux server architectures. ZeroHTTPd doesn't implement the HTTP protocol in full and you…",{"value":55,"source":49,"evidence":56},"Teach how Linux network servers are written and perform, comparing architectures",[57],{"id":52,"by":11,"text":53},[59],{"value":60,"source":61,"evidence":62},"C","inferred",[63,67],{"id":64,"by":65,"text":66},"20082163","marios","Had a quick glance and while the content seems worthwhile I am a little saddened by the code. There are numerous calls to strcpy() which is a buffer overflow waiting to happen. I…",{"id":68,"by":69,"text":70},"20082547","layoutIfNeeded","Very nice writeup! Although I’ve noticed that it’s written in C. I would suggest educational materials to be written in Rust, unless the topic is very low-level optimization.…","unknown","launched",{"praise":74,"objections":91,"requests":118,"questions":147,"alternatives":165},[75],{"value":76,"source":77,"evidence":78},"Useful, well-written tutorial that explains server internals","commenter",[79,83,87],{"id":80,"by":81,"text":82},"20081934","navinsylvester","Very insightful article. Thanks for putting it together. Looking forward to an update with io_uring.",{"id":84,"by":85,"text":86},"20082968","cadamangue","Great article, explains things better than most O'Reilly books.",{"id":88,"by":89,"text":90},"20084599","antisemiotic","Heh, you beat me to publishing my own simple HTTP server. Though the one I'm working on is even more dumbed down, only supporting GET to serve prepared HTTP messages from a hash…",[92,100,111],{"value":93,"source":77,"evidence":94},"Not safe to run; uses unsafe strcpy and buffer handling",[95,96],{"id":64,"by":65,"text":66},{"id":97,"by":98,"text":99},"20084955","GuB-42","strcpy() is actually fine when used with literal\u002Fconstant strings and the buffer is large enough. The compiler can even optimize it and issue warnings in case of overflow.…",{"value":101,"source":77,"evidence":102},"Benchmarks omit HTTP keep-alive, making results misleading",[103,107],{"id":104,"by":105,"text":106},"20083154","tele_ski","So there is no keep alive in these tests including lb to application? Makes sense why the qps is so low on a single core for all versions tested if nginx is having to reopening a…",{"id":108,"by":109,"text":110},"20085451","otabdeveloper3","Testing \"Linux server architectures\" without considering keepalive is worse than useless.",{"value":112,"source":77,"evidence":113},"Only HTTP\u002F1.0 and minimal header handling",[114],{"id":115,"by":116,"text":117},"20081986","masklinn","> I guess it is 1.1 Negative ghost rider, it's hard-coded to 1.0: https:\u002F\u002Fgithub.com\u002Fshuveb\u002Fzerohttpd\u002Fblob\u002Fmaster\u002F01_iterative\u002Fmain.c#L468 (in reality it's barely even that e.g.…",[119,130,140],{"value":120,"source":77,"evidence":121},"Add io_uring variant",[122,126],{"id":123,"by":124,"text":125},"20081560","daurnimator","Need a uring based one! http:\u002F\u002Fkernel.dk\u002Fio_uring.pdf",{"id":127,"by":128,"text":129},"20081537","cbsmith","Needs async IO variant as well...",{"value":131,"source":77,"evidence":132},"Add kqueue-based version for BSD",[133,137],{"id":134,"by":135,"text":136},"20084419","snvzz","Notably lacks part VIII, kqueue-based server. This is because Linux doesn't support kqueue. Got to make do with their pointless NiH syndrome fueled epoll().",{"id":138,"by":11,"text":139},"20091933","I've never really done any serious work on anything other than Linux. But I always wanted to try out kqueue(). Even if I don't add a separate section on kqueue(), I think it…",{"value":141,"source":77,"evidence":142},"Report memory usage in benchmarks",[143],{"id":144,"by":145,"text":146},"20083092","megous","It would be nice to also compare memory use, which will vary between implementations.",[148,155],{"value":149,"source":77,"evidence":150},"Would it scale on many-core machines?",[151],{"id":152,"by":153,"text":154},"20082076","dominicl","Awesome comparison, super curious how this would scale out on the current generation of big CPU machines. E.g. Epyc with 64 cores, would threads still perform that well?",{"value":156,"source":77,"evidence":157},"Does it work with sendfile on OpenBSD?",[158,162],{"id":159,"by":160,"text":161},"20082804","cyberpunk","OpenBSD doesn't have sendfile as far as I know so maybe s\u002FOpen\u002F\u002F there too",{"id":163,"by":160,"text":164},"20083131","That manpage is an import from freebsd, not part of base -- As far as I can see on my system it's not there: OpenBSD: ``` $ man 2 sendfile man: No entry for sendfile in section 2…",[166,176,183],{"value":167,"source":77,"evidence":168},"Nginx",[169,172],{"id":170,"by":11,"text":171},"20083011","Yes, IIRC, even Nginx uses the general structure you're describing.",{"id":173,"by":174,"text":175},"20083938","wolf550e","nginx and others use worker processes instead of worker threads, with epoll in each worker. This is for robustness and garbage collection, AFAIK.…",{"value":177,"source":77,"evidence":178},"lwan",[179],{"id":180,"by":181,"text":182},"20082746","_pmf_","Another project in the performance oriented Linux HTTP servers is https:\u002F\u002Flwan.ws\u002F (using pervasive zero copy), but as far as I know it does not cover a lot of features yet.",{"value":184,"source":77,"evidence":185},"Apache mpm_event",[186],{"id":187,"by":188,"text":189},"20088880","xorcist","So does Apache with mpm_event, which has been around for close to 15 years now. The fact that you can run Apache in a process pool model doesn't mean you should. That mode was…",{"comments":191,"answered":31,"key":192},18,[193,196,199],{"id":194,"text":195},"20082178","Points well taken, marios. Will try and fix strcpy(). Should certainly mention kqueue(), too. Will fix. Thanks.",{"id":197,"text":198},"20083099","OpenBSD and FreeBSD do have sendfile(), but args are different compared to the interface presented by Linux. It should be trivial to write a wrapper, though:…",{"id":200,"text":201},"20084174","OK, noted. Thanks for sharing.",{"commenters":203,"max_depth":34,"maker_replies":191,"first_comment_mins":204,"lifespan_hours":203},33,16,[206,208,210,212,214,215,218,220,221,223,227,230,234,236,239,242,245,246,248,251,252,254,258,260,262,263,264,267,268,269,271,275,278,280,282,284,287,291,293,296,298,300,303,305,307,310,312,316,319,321,323,326,328,330,332,335,337],[64,33,39,207,65,33],"project\u002Fcritical\u002Fexecution",[194,33,33,209,11,39],"maker\u002Fpositive\u002Fnone",[159,33,41,211,160,33],"project\u002Fneutral\u002Fdocs",[197,33,33,213,11,39],"commenter\u002Fneutral\u002Fnone",[163,33,33,213,160,33],[216,33,33,213,217,33],"20083211","dallbee",[219,33,33,213,160,33],"20083234",[200,33,33,213,11,39],[97,33,41,222,98,33],"project\u002Fneutral\u002Fexecution",[224,39,44,225,226,33],"20082620","project\u002Fpositive\u002Fperformance","pjc50",[228,39,33,229,11,39],"20083049","other\u002Fneutral\u002Fnone",[231,39,41,232,233,33],"20084226","project\u002Fneutral\u002Fnone","joosters",[123,18,41,235,124,33],"project\u002Fneutral\u002Fidea",[237,18,33,238,11,39],"20081581","maker\u002Fneutral\u002Fidea",[240,18,41,211,241,33],"20083453","mistrial9",[243,18,33,229,244,33],"20084195","the8472",[180,41,41,235,181,33],[247,41,33,209,11,39],"20082991",[249,31,41,211,250,33],"20081948","okket",[115,31,39,207,116,33],[104,31,39,253,105,33],"project\u002Fcritical\u002Fperformance",[255,31,33,256,257,33],"20083768","commenter\u002Fneutral\u002Fperformance","derefr",[259,31,33,256,105,33],"20090186",[261,31,33,256,233,33],"20084162",[52,31,33,238,11,39],[108,31,39,253,109,33],[265,44,41,235,266,33],"20082686","bvinc",[170,44,33,235,11,39],[187,44,33,213,188,33],[173,44,33,270,174,33],"commenter\u002Fneutral\u002Fidea",[272,273,41,274,244,33],"20081670",6,"project\u002Fneutral\u002Fperformance",[276,273,41,274,277,33],"20082192","kim0",[279,273,33,256,244,33],"20084106",[80,34,44,281,81,33],"project\u002Fpositive\u002Fnone",[283,34,33,209,11,39],"20082168",[88,285,44,286,89,33],8,"project\u002Fpositive\u002Fidea",[288,285,33,289,290,33],"20088463","other\u002Fpositive\u002Fnone","bgilroy26",[292,285,33,209,11,39],"20091941",[84,294,44,295,85,33],9,"project\u002Fpositive\u002Fdocs",[297,294,33,209,11,39],"20083019",[144,299,41,274,145,33],10,[301,299,33,302,11,39],"20083115","maker\u002Fneutral\u002Fperformance",[152,304,41,274,153,33],11,[306,304,33,302,11,39],"20082144",[308,304,33,229,309,33],"20082707","knotty66",[311,304,33,209,11,39],"20082999",[313,304,39,314,315,33],"20084547","maker\u002Fcritical\u002Fperformance","jrockway",[317,304,33,256,318,33],"20096290","BanazirGalbasi",[127,320,41,235,128,33],12,[322,320,33,238,11,39],"20081597",[324,320,33,270,325,33],"20081769","snaky",[327,320,33,209,11,39],"20082114",[329,320,33,229,128,33],"20097226",[68,32,39,331,69,33],"project\u002Fcritical\u002Fidea",[333,32,33,334,11,39],"20082960","maker\u002Fneutral\u002Fnone",[134,336,39,331,135,33],14,[138,336,33,238,11,39],[],[340,345,350,354,359,364],{"id":341,"name":342,"points":343,"category":344},"20105567","Bloom",747,"web_saas",{"id":346,"name":347,"points":348,"category":349},"20094866","html_wysiwyg",633,"dev_tools",{"id":351,"name":352,"points":353,"category":349},"20060549","medium-to-own-blog",494,{"id":355,"name":356,"points":357,"category":358},"20101381","mlsql",209,"ai",{"id":360,"name":361,"points":362,"category":363},"20049075","notational-fzf-vim",171,"productivity",{"id":365,"name":366,"points":367,"category":363},"20077177","Nullboard",145,false,"v2",{"id":371,"name":5,"line":6,"ai":368,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":372,"top":18,"kw":373,"maker":11,"domain":10,"tier":19,"attempts":33,"strip":374,"url":9,"mix":375,"praise":76,"objection":93,"sub":21},20081488,-0.04,[24,25,26,27],"1030003533330310001003350505303010300101",[31,32,33,34],1793990990104]