How to balance performance with accuracy when you have a lot of contacts and smart groups

Groups that have either more than 100,000 contacts or more than several hundred smart groups (or both) may want to tweak your database settings to get the best performance possible.

Read on to learn what options are available.

Caching

Caching is a way to save the results of a contact search in a simple table so the next time you need that list of contacts you can quickly retrieve it from the table rather than re-running the search.

Often, running a search is slow: it might take 5 or 10 seconds to complete. However if the first time you run the search you save the results in a table (called a "cache"), you can retrieve the contacts from the table in less than a second without having to re-run the search. That makes everything run faster.

There is only one problem: What happens if the cached contacts become stale? In other words, what if you search for everyone in the zip code 10002 and the results are stored in a cache table. Then, you add a new contact with that zip code. Your new contact won't be in the cache table.

Typically, PowerBase handles this situation by deleting the cache anytime there is a change in the database that might alter the correct results of any search (then the search is re-rerun the next time it is needed). If PowerBase detects that a record was edited, the cache is cleared. If a donation was added, the cache is cleared, etc.

The Problem

With small sets of data and sites with few smart groups, this works great. We get the best of all worlds: fast cached searches that are always accurate.

However, if you have hundreds of smart groups, we start to see problems. It might take a few seconds or even a minute to fully clear all the caches. If multiple records are edited in rapid succession you can create a real train wreck of cache clearing.

The result may be a "deadlock" - which will be displayed to you or your users as an ugly list of errors when you try to edit/view/save a record (and the record is never edited/viewed/saved).

The solution

Prior to PowerBase 4.7 (released on October 16, 2016), the problem of cache clearing was severe. Since 4.7, a number of steps have been taken to avoid such conflicts which will resolve the problem of deadlocks on most sites (there is a technically detailed blog post on the 4.7 caching improvements which reviews exactly what has changed).

For sites that continue to experience this problem, there is one more step we can take: we can enable "deterministic" clearing of your cache.

That means that your cache will be cleared every 15 minutes regardless of what records are edited/saved/changed.

In other words, if you edit a record in a way that should result in it being added to a new smart group, it may take up to 15 minutes for the record to appear in the smart group.

That's the downside.

The upside: you should avoid all deadlocks and your database will perform extremely quickly

All PowerBase members are invited to request this setting. If you don't like it, we can always switch it back. Just let us know by sending an email to support.

Category: 
Search