We are using BuddyPress on NYT (largest recipe website of Turkey) and I want to share some ideas and experience about scaling BuddyPress. (We might be second largest BuddyPress user)

1) Scaling WordPress

First of all we need to know scaling WordPress because (as you know) BuddyPress is a WordPress plugin. I don’t want to go into detail, you can reach so many helpful resources about it.

We use these technologies in our infrastructure – stackshare.io/nefisyemektarifleri-com/nefisyemektarifleri

2) Storage

Who remembers old multisite problems like – https://codex.wordpress.org/How_to_Scale_WPMS

The ext2/3 filesystems on Linux only allow 32,000 files or directories in a directory. Thankfully ext4 haven’t this limitation. (I mean in theory) You shouldn’t put hundreds of thousands objects into same directory, (that’s insane)

BuddyPress’ default upload structure is not good for large scale but don’t worry you can change structure via proper filters.

We use daily based structure and sync to s3. When varnish couldn’t reach image from storage server, it fetches from s3.

Btw, BuddyPress-VIP-Go can give some ideas. Thanks Paul.

Pro tip: When you add new attachments to post which published “23/09/2015” WordPress puts new uploads to “…/uploads/2015/09/foo-bar.jpg” (if you organize uploads into month- and year-based folders)  when your uploads directory contains millions of objects this approach is not efficient. (rsync process began to take longer and eats your CPU)

Thankfully, we have `upload_dir` filter. We can organize uploads daily basis and sync fresh uploads only.

 

3) Notifications

We have a lot of custom events. For example, when your recipe added more than x time to users cookbook we add new notification.

We have developed robust notification system over BuddyPress. It supports, push notification(we use Parse), web push notification and email notification.

Some of our events are really heavy, for example when video of recipe publish on website, we send notification who added that recipe to their cookbook. That means, thousands of records into notification table.

We are using RabbitMQ for queueing things and we use custom WP-CLI commands as worker which are running on server’s screen.

4) Core hacks (Yikes!)

I confess, we are doing quick and dirty solution sometimes, one of them is `bp_notifications_get_all_notifications_for_user` function, it caches all notifications for user and we added hard limit there. (My Boss reported this problem on trac as well.)

So shortly;

Can Buddypress support hundreds of thousand of users?

– Yes, obviously.

I want to be next facebook, can BuddyPress do that?

– trust me, you won’t be next facebook 🙂

I need X feature which is not exist in BuddyPress core?

– Simple, write a plugin for BP, for example one of our core feature is “following” and it’s just a BP plugin. (Thanks r-a-y)

If you have question, leave me comment below, I would like to hear questions from you 🙂

Cheers,

Join the Conversation

6 Comments

  1. I am really amaze on how you are handling such a large user base with buddypress , i got to know about you when i read your post on buddypress site , I was a bit confused on implementing my idea on buddypress .your post really motivates me to. Btw how large is your community now and what type of server configuration you use.

    1. it’s more than 3+ million users now. The application servers run with docker and we use PHP 7.2, but there are so many things to configure at scale. Loadbalancers, MySQL, caching layer etc…

      1. Well that is a lot of user bro how do you manage the email service i mean do you have separate server for sending email for user registration or the default wordpress email script. your post motivates me so much to me that i launched my site to test my idea and if it grows i will really like to be in touch with for scaling.

        1. We use Amazon SES, and there are some other alternative “transactional email” services too. (SES is cheaper at large volume)

          1. Thanks for the reply, may contact you for help if our site grow btw any tips if you want to share for the newly launched site for getting prepared for scaling

  2. I feel that is one of the most vital info for me. And i am satisfied reading your article.
    However want to statement on few common issues, The web site taste is ideal, the articles is in reality excellent : D.
    Just right process, cheers

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.