Felix Palmen :freebsd: :c64:<p>I just stress-tested the current dev state of <a href="https://mastodon.bsd.cafe/tags/swad" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>swad</span></a> on <a href="https://mastodon.bsd.cafe/tags/Linux" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Linux</span></a>. The first attempt failed miserably, got a lot of errors accepting a connection. Well, this lead to another little improvement, I added another static method to my logging interface that mimics <a href="https://mastodon.bsd.cafe/tags/perror" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>perror</span></a>: Also print the description of the system errno. With that in place, I could see the issue was "too many open files". Checking <a href="https://mastodon.bsd.cafe/tags/ulimit" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ulimit</span></a> -n gave me 1024. Seriously? 🤯 On my <a href="https://mastodon.bsd.cafe/tags/FreeBSD" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>FreeBSD</span></a> machine, as a regular user, it's 226755. Ok, bumped that up to 8192 and then the stress test ran through without issues.</p><p>On a side note, this also made creating new timers (using <a href="https://mastodon.bsd.cafe/tags/timerfd" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>timerfd</span></a> on Linux) fail, which ultimately made swad crash. I have to redesign my timer interface so that creating a timer may explicitly fail and I can react on that, aborting whatever would need that timer.</p><p>Anyways, the same test gave somewhat acceptable results: throughput of roughly 3000 req/s, response times around 500ms. Not great, but okayish, and not directly comparable because this test ran in a <a href="https://mastodon.bsd.cafe/tags/bhyve" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>bhyve</span></a> vm and the requests had to pass the virtual networking.</p><p>One major issue is still the <a href="https://mastodon.bsd.cafe/tags/RAM" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>RAM</span></a> consumption. The test left swad with a resident set of > 540 MiB. I have no idea what to do about that. 😞 The code makes heavy use of "allocated objects" (every connection object with metadata and buffers, every event handler registered, every timer, and so on), so, uses the <a href="https://mastodon.bsd.cafe/tags/heap" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>heap</span></a> a lot, but according to <a href="https://mastodon.bsd.cafe/tags/valgrind" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>valgrind</span></a>, correctly frees everything. Still the resident set just keeps growing. I guess it's the classic <a href="https://mastodon.bsd.cafe/tags/fragmentation" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>fragmentation</span></a> issue...</p>