How database encryption and obfuscation affect performance

You can encrypt the database to increase the security of the information stored in UltraLite. However, you should note that there is an increase in overhead of between 5-10% as a result, resulting in decreased performance. The exact effect on performance depends on the size of your cache. If your cache is too small, encryption can add significant overhead. However, if your cache is sufficiently large, you may not see any difference at all. To determine what the optimal cache size for your scenario is, you can graph the database performance with benchmark tests.

Stressing the cache

You can benchmark test different cache sizes and watch for performance to change abruptly. Your cache should be large enough to have a good working set of pages. Consider the following ideas to help you stress the cache:

  • Create multiple indexes on the table and add foreign keys.

  • Insert rows randomly (something other than the index order).

  • Create large rows, at least 25% of the database page size.

  • Set the index hash to something other than 0. This increased size also increases the page accesses needed.

  • Start graphing performance based on the smallest cache size. For example, 256 KB on Windows NT (the smallest allowed cache for this platform) or 64 KB on all other platforms.

If you find that increasing the cache does not improve the performance of an encrypted database, consider obfuscating the data rather than encrypting it. Obfuscation can yield better performance while still offering some security benefits; the obfuscation algorithm uses less code compared to strong encryption, and performs fewer computations. Simple encryption performance should only be marginally slower than no encryption at all. However, your security requirements must ultimately dictate whether you choose to use strong encryption or not.

See also