Performance

#The basics

WP Fusion was designed with performance in mind, and is used on sites with hundreds of thousands of users, and stores processing thousands of transactions a day.

Unlike some other membership plugins with CRM integrations, WP Fusion will only connect to your CRM as a direct result of user action. For example:

  • Updating a profile
  • Making a purchase
  • Completing a course

WP Fusion does not connect to your CRM to authenticate user logins, and it does not run any background synchronization processes.

Another benefit of this is that even if your CRM’s API is offline or unreachable, your users will still be able to log in and access their content.

#General tips

On a fresh install WP Fusion will have no noticeable impact on your site’s speed at all. However there are some steps you can take to maintain optimal performance on your WP Fusion powered site.

#Use webhooks

WP Fusion includes the option to load your user’s latest tags and meta data from your CRM on login.

While this is an easy way to make sure their data is always up to date, this will slow down the login process while the various API calls are made.

Instead, set up webhooks from your CRM to WP Fusion. You can trigger a webhook only when something has modified and needs to be updated in WordPress. Since webhooks run in the background, your users’ updated tags and meta data will already be available when they log in.

#Keep “Push All” turned off

WP Fusion has a setting that will sync data to your CRM whenever any field in your database is modified.

This setting is intended for people using plugins or custom code that isn’t supported by WP Fusion, but shouldn’t be necessary on normal sites. Leaving this setting on may result in unnecessary API calls being sent.

#Be careful with “Linked” tags

WP Fusion includes a powerful feature called “Link with tag”, which allows you to automate enrollment into courses, groups, and membership levels when a tag is applied.

As a general rule, only specify a linked tag if you’re trying to trigger an automated enrollment via an outside trigger. For example a product purchase in an outside shopping cart, or using a drip sequence in your CRM.

If you are using linked tags, avoid overlapping their functionality. For example if you have a linked tag that enrolls someone into a membership, and that membership includes bundled courses, it’s not necessary to set a linked tag on each of the courses as well. This can create a chaining situation which can slow down your site.

#The technical stuff

WP Fusion includes a few technologies to keep your site running fast.

#Asynchronous webhooks

By default incoming webhooks are processed in real time. When the webhook is received WP Fusion connects to your CRM and loads the relevant data. This generally works well, but if many webhooks are received at once (i.e. several hundred), this could cause your server to get overloaded and some webhooks may be ignored.

You can get around this by appending &async=true to the end of your webhook URL. This will cause WP Fusion to put your incoming webhooks into a queue and work through them as server resources allow, usually within a minute or two. While this does slow down the amount of time to process a single webhook, it allows WP Fusion to receive and act on more incoming webhooks simultaneously.

#The API queue

The API queue is enabled by default, though it can be turned off for troubleshooting purposes. The setting is under the Advanced tab.

With the API queue on, WP Fusion puts all API calls into a buffer and executes them during PHP’s shutdown function.

This means that any delay introduced by API calls will happen in the footer of the page, after the page has already loaded for the site visitor.

The queue also combines redundant calls into a single API call. For example

wp_fusion()->user->push_user_meta( $user_id, array( 'first_name' => 'John' ) );

wp_fusion()->user->push_user_meta( $user_id, array( 'user_email' => '[email protected]' ) );

With the API queue off these two function calls would trigger two API calls. With the queue on it will just send a single API call.

The queue combines calls that:

  • Apply tags
  • Remove tags
  • Update contacts

#Asynchronous checkout

Depending on the addons you have installed, a checkout can take a lot of time to process— adding a contact, applying tags, adding products, adding an invoice, and removing abandoned cart tags.

To speed this up, WP Fusion has an option for Asynchronous Checkout with WooCommerce and Easy Digital Downloads. This setting is enabled by default and can be found on the Integrations tab.

With async checkout enabled, WP Fusion will send a non-blocking POST request to a background worker on your server. This lets WP Fusion process all the API calls in the background without delaying the checkout.

#The background process worker

WP Fusion includes a background worker which can export users, membership statuses, order details, and more to your CRM.

This background worker is based on the WP Background Processing library. Items to be processed are added to a queue and are worked through sequentially, taking into account the server’s available memory and max execution time.

Using the background worker we have processed up to 300,000 WooCommerce orders in a single go.

The background process can run for up to 24 hours. This can be extended if needed by using the 'nonce_life' filter.

#Admin performance

If you have a lot of tags and/or custom fields in your CRM (i.e. 1,000+ options), the WP Fusion interfaces can be slow to load in the admin.

To avoid this, WP Fusion has two built in thresholds:

  1. If there are more than 300 custom fields available for sync on the Contact Fields list, the field select dropdown will revert to a standard HTML dropdown instead of the searchable select2 dropdown.
  2. If there are more than 1,000 total tags in your CRM, the Select Tag(s) dropdown will lazy load the tags instead of trying to display all the options at once. After you’ve entered the first three characters of your tag name, WP Fusion will search the database and return the results.

There are three filters you can use to further customize the display of the tags and CRM fields dropdowns:

add_filter( 'wpf_disable_tag_multiselect', '__return_true' );

Completely disables the Select Tag(s) select box. It will not be output on the page at all.

add_filter( 'wpf_disable_tag_select4', '__return_true' );

Disables the enhanced interface on the Select Tag(s) select box. It will be displayed as a normal select input.

add_filter( 'wpf_disable_crm_field_select4', '__return_true' );

Disables the enhanced interface on the Select A CRM Field select box. It will be displayed as a normal select input.

Was this helpful?