Cache rules are defined per cluster. These are simple patterns or expressions for ScaleArc to parse against and, if matched, serve directly from ScaleArc’s memory. ScaleArc creates a hash map similar to that of memcached, which can achieve up to 12x faster performance than conventional database servers.
Before configuring a cache pattern for a particular database user, make sure you have configured the database for the user in Users & DBs.
ScaleArc provides simple and flexible ways to create cache rules. Note that cache patterns are case-sensitive.
- On the ScaleArc dashboard, click Clusters > Settings > Transparent Cache.
- Click the Cache Rules tab.
Configure the fields as follows:
Field Description Default/User Input Query caching ON/OFF button
Query Caching can be explicitly turned OFF or kept ON.
Default is ON. Order Determines the order in which the rules get executed. Switch the order as needed. Cache limits
Determines the maximum cache limit. 0 is the default which means unlimited up to the license limit.
Default is 0. Import Rules
This feature enables importing the cache rules from a .csv file that was generated from ScaleArc. This option saves you the effort of recreating cache rules; for instance, you can import them from another ScaleArc cluster for reuse.
Enter name. Export File
This feature enables exporting all the cache rules into a .csv file so that it can be imported to another ScaleArc or cluster easily.
Database A list of databases in the cluster. Click on the Gear icon to edit. Pattern stats A list of active and inactive patterns in the cluster. Click on the Gear icon to edit. Gear icon (edit)
ScaleArc provides simple and flexible ways to manually create cache rules.
Click the gear icon to open the Query Pattern edit screen.
The Query screen lets you view and define query patterns with regular expressions that filter the traffic that passes through the ScaleArc interface. You can read more about how Regular Expression patterns work here.
Any query matching a specified pattern is cached within the ScaleArc appliance for the specified TTL (time-to-live). Such cached queries are delivered to the application directly by the ScaleArc appliance significantly faster than the database thereby improving the overall performance of your application. Cache patterns added for a particular logical database apply to SQL sessions from any user who issues queries for that logical database.
- On the ScaleArc dashboard, click CLUSTERS > Settings > Transparent Cache > Cache Rules tab.
- Click on the Gear icon against the database of choice.
Configure the screen as follows:
Field Description Default/User input Add Pattern button Opens the related screen. Create a pattern and ensure that it fits the order in which you want it executed. You cannot edit the pattern in the same field. See below. Order Determines the order in which the rules get executed. Switch the order as needed. Pattern
Patterns can include any Perl Compatible Regular Expression. We typically see wild card expression to create simple rules. This option can only be deleted.
Delete the pattern. TTL
Defines when the cache expires.
Enter a value when you create a pattern. Enable/Disable
Disables or enables a cache rule from executing, depending on its state. You can enable or disable this option during or after you create the pattern.
The default is enabled.
You can also click on the delete icon to delete the cache rule.
Click icon to delete
Add a pattern
- Click on the Add Pattern button.
- Enter the order number.
- Tab over and enter the pattern's Regular Expression in the next field.
- Enter the TTL value and enable/disable as required.
- Click Save.
- To edit, delete the pattern and recreate, using the Add Pattern button.
In pre-cache you can specify the actual query which ScaleArc will run at a specified interval and cache the response for the same. You should have a matching pattern in Query Cache to get the response from the cache.
Follow the steps below to add a pre-cache rule:
- On the ScaleArc dashboard, under the Settings column > Transparent Cache.
- Click the Pre-Cache Rules tab and turn on Pre-caching using the toggle button. Click Yes to change the Pre-Caching configuration.
- Complete the configuration as shown in the section Add a Pattern.