This a guest post by Mustafa Uysal (m_uysl). He is from Turkey and works as a full-stack developer at NefisYemekTarifleri.com.

Peer reviewed by @boonebgorges

nefisyemektarifleri site

NefisYemekTarifleri.com is the largest Turkish recipe sharing platform in the world. It has more than 290,000 recipes that reach millions of users every single day. NefisYemekTarifleri is a unique platform that uses WordPress and BuddyPress for all its applications — desktop, mobile web, Android, iOS, and AndroidTV.

Current status:

  • 290k+ recipes, ~500 new recipes from different authors per day
  • ~2.2M+ registered users with ~2.6M xprofile_data, 24M+ usermeta
  • ~4M native apps download, ~1M active usage
  • ~100TB CDN BW usage per month
  • 3M+ BuddyPress activities and ~4M+ notifications
  • 300k+ search requests per day

We use ElasticPress to handle 10M+ requests. To scale this platform, we use various tools which we share at Stackshare. We share some of our stats on Twitter #nytstats.

BuddyPress for a Growing User Base

NefisYemekTarifleri.com is turning 10 years old this August and has been using BuddyPress for the last 5 years. According to my boss, “BuddyPress has helped a lot to increase our user base.”

Our platform is community-driven, i.e., all the recipes come from our users. The membership and number of recipes submitted have increased dramatically since we started using BuddyPress. The users feel more welcome because they have their “own space” where they can easily add their avatars, cover images, post their recipes, and share other social media links. BuddyPress has enabled users to engage more with other registered members as well as invite new users to the site. Our editorial team spends a majority of their time editing user recipe submissions.

Currently, we are using all BuddyPress core components except Friends and Groups. Thankfully, r-a-y‘s BuddyPress Followers plugin is a great replacement to the built-in Friends component.

Customized BuddyPress Features

Notifications

Our notification system is quite different from the standard BuddyPress notifications. It supports push and web push notifications and works async over the message queue.

Site notifications schema

There are a lot of activities which can trigger notifications. There were and are many instances when we send notifications to tens of thousands users every day. For example, when one author with thousands of “followers” publishes a new recipe, it took a long time to send a simple notification like, “Hi there! Jane Doe published a new recipe, take a look!” Consider when we have 10 authors with many followers publishing new recipes at the same time.

In the early days, we created a custom `nyt_bp_add_notification` script which called BuddyPress’ own notification that added a function for bulk messaging. We found out that it was causing lags on our slave MySQL servers because the impact on the disk IO was dramatic. Our solution was a new custom script, `nyt_bp_add_bulk_notification`, which inserts data directly to database (as a bulk SQL query). By the way, we highly recommend Percona’s PMM for catching performance hogs.

At the end of 2016, we migrated from parse.com to our self hosted parse for push notifications. After which, we used web-push-php for the web push notifications.

Cover Image

We decided to replace the built-in cover image feature and create our own Facebook-inspired UI which was more user-friendly. The feedback has been quite positive from our members.

New cover image UI

Features of our new cover image UI:

  • A user can directly upload a cover image by clicking on an icon on top of the cover image area.
  • The full-size image is saved behind the scenes.
  • Quick image resizing after the image upload has completed.
  • A user can change image position via drag-drop.
  • The full path and image coordinates are recorded as meta.

Messages

The Messaging component is active but not fully open for the end users. We will make this available for everyone when we’ve completed our mobile app integration. This is how we are setting this up for our site:

  • All messages have to be between two people, we canceled group messaging.
  • When someone you are not following sends a message, that message is marked as “pending”. You also “block” that person.
  • Fluent messaging: all conversations between two people use the same thread.

Workarounds/Hacks/Yikes!

Cache: We hated touching BuddyPress directly, but we had to hack core file to fix memory issues. (We have submitted a patch that reduces memory usage for BP#7130)

Messaging, reimagined: We made some necessary changes a bit in a hacky way on the messaging component. Changing messaging behavior was not easy and there are some edge cases we have to monitor and address.

Limit notifications: Only allow 200 notifications per user, WordPress’ cron cleans up on a daily basis.

API Endpoints: We had to be careful on managing API endpoints, addressing the mobile apps a bit differently than web, especially when you do caching inside the device.

Long-running process: MQ workers are long-running PHP scripts and they caused memory problems on production after a while. We fixed this issue with stop_the_insanity.

In the Works

Following are some of the features we have in queue:

  • Upgrading BuddyPress, of course
  • Elasticsearch integration over ElasticPress. (We haven’t tried it yet but Pascal already wrote some code we can start playing with.)
  • User suggestion to follow a member.
  • Activity improvements (currently, just acting like feed).
  • PHP 7.1 upgrade with dockerizing all the things. (Still using different versions of PHP)

BuddyPress allows us to build one of the largest niche communities in the world. Fortunately for everyone, BuddyPress is being maintained by developers who are active contributors to WordPress core. Our thanks to all BuddyPress contributors, especially the BP core team.

Mustafa Uysal Mustafa Uysal of NefisYemekTarifleri.com also runs his own company, SKOP. He’s a plugin developer who enjoys solving tough problems and making things faster and scalable. He’s also a workaholic and was interested in archery once upon a time. Mustafa is one of the WordPress Translation Editors for the Turkish language.
Links: Twitter, Github, WordPress.org, Linkedin, Instagram, My Blog, and nefisyemektarifleri