Good performance of godev.com

Viewed 162

I found the website godev.com from the Apache Answer project. I am developing a site using Apache Answer. What surprised me about godev.com was the very high performance of the pages. I did not see this performance in meta.answer.dev either.

Can you explain what actions you have taken to improve the performance of Apache Answer?

2 Answers

Hey a few thoughts –

By default answer was using sqlite and writing sessions to disk. This website is using mysql with redis-cache plugin for caching and sessions. I had issues with load balancing and horizontal scaling until switching to redis cache plugin. Probably due to file system latency when using a shared mount for reads/writes as the containers scaled up/down across worker nodes.

I modified the build steps for the UI so static assets (js, css, fonts) are uploaded to a cdn after the build. This also uses an ENV var as part that step so the js bundler knows where it will be loading files from:

# Build the UI.
PUBLIC_URL="https://cdn.godev.com/answer/ui/${COMMIT_HASH}/" make ui

# Upload the UI build to the CDN.
s3cmd put /workspace/ui/build/* s3://${DO_S3_CDN_BUCKET}/answer/ui/${COMMIT_HASH}/ --recursive

# Build the answer binary.
PUBLIC_URL="https://cdn.godev.com/answer/ui/${COMMIT_HASH}/" \
ANSWER_MODULE="/workspace" ./answer build \
    --with github.com/apache/incubator-answer-plugins/connector-basic \
    --with github.com/apache/incubator-answer-plugins/cache-redis \
    --output /workspace/new_answer

They've also got an S3 storage plugin, but it's not enabled here right now. From what I can tell it was mainly for file attachments (file in posts, user avatars, branding, etc). It didn't handle resizing when I last tried so didn't enable it. Plan to revisit that when I've got time.

This website is also hosted in Eastern US only right now other than the additional points of presence for CDN files. Not sure where you're located, but that could have something to do with it as well. If there is ever enough traffic here to justify it, I'd probably setup geo DNS and add another k8s cluster in EU or Asia and split traffic that way.

This website has less content than those as well, so perhaps it could slow down eventually.

Here's a screenshot of regional latency on godev.com FWIW: