O

Obimap

Hobby-focused social website

Server: Speed up SSR rendering

Replace i18next with intl-messageformat:
- Complex page: 400ms to 300ms

Switch from React/Next to SolidJS/Vite:
- Complex page: 300ms to 50ms (1.1s to 260ms on an atom CPU)
- Simple page: 30ms to 8ms

Alternatives:
- Windowing: not an option, as I wanted all the data to be available at any given time for easier search/navigation
- Client-Side Rendering only: not an option, as I wanted to keep server-side generated html
- Basic templating (with caching) and simple js for client-side interactivity: could be interesting to explore this direction

Deploy: Speed up deploy process by switching to rsync / native Node.js / pm2

=> Managing deploys with rsync / native Node.js process makes the deploys faster (only a few KB to transfer instead of ~230MB for the podman image)
=> Using `next start` instead of Next.js `standalone` build allows for 15-30% performance boost (not sure why the Next.js `standalone` build mode has a slower runtime)
=> `pm2` is really nice to handle staging / prod services, and keep them running after a reboot

Server: Benchmarking the cause of slowness...

Results from running many wrk benchmarks:

~4-6% overhead from podman vs native Node.js process (probably due to running podman rootless, which might incur a small performance overhead (for networking?))
~15-30% overhead from Next.js `standalone` build vs `next start` 😱

Deploy: Setup a registry-less deploy process with podman

Basically:

podman build -t myapp-dev .
podman image scp myapp-dev my-server::
ssh dev@my-server 'podman stop myapp-dev; podman container rm myapp-dev; podman run -d -p 127.0.0.1:3000:3000 --name myapp-dev myapp-dev'

(then, serve it with an nginx reverse proxy)

Settled internationalization (-> switching back to one-language only for the first iteration)