Optimization


Useful commands

TRAX LRS performances can be improved with a few commands that you should run on your production server:

composer install --optimize-autoloader --no-dev
php artisan config:cache
php artisan route:cache

These commands must be run again after each application update.

The php artisan config:cache command must be run again after each config change.

You should not cache your config and your routes on your development server. If you did it, you can remove the caches with:

php artisan config:clear
php artisan route:clear

High-speed configuration

Some xAPI use cases may require a high level of writing performances. Think about a simulation writing hundreds of statements per second. If you are in such a situation, consider the following options.

Choosing the right configuration profile

If your priority is to optimize writing performances, you should consider using the basic configuration profile.

This profile will record only statements and activities, as required by the xAPI specification, without indexing data. So the LRS will record statements faster.

Disabling activities recording

The xAPI specification requires that the LRS must extracts activities from the incoming statements, and record or update them into the database, so they become available thru the Activity API.

However, recording activity definitions may be useless if you don't need to use the Activity API. So if you don't care about breaking the xAPI conformance test, you can disable the activities recording.

DISABLE_ACTIVITIES_RECORDING=true

This option will be ignored if you don't use the basic configuration profile because activities recording is needed to support the other configuration profiles.

Disabling or delaying statements validation

The xAPI specification requires that all the incoming statements must be validated before being recorded into the LRS.

However, validating statements may be useless if your statements always come from the same conformant providers. So if you don't care about breaking the xAPI conformance test, you can disable the statements validation.

DISABLE_STATEMENTS_VALIDATION=true

This option can be used with any configuration profile. It will speed-up the writing process and you will be able to validate the statements later with the following command:

php artisan statements:validate

See statements validation.

Laravel queues

Using Laravel queues brings a few benefits:

  • Web requests on the APIs are faster.
  • Writing operations on the database are optimized.
  • Concurrency issues are better managed.

Check the Laravel queues page to go further.

Redis cache

Using the Redis cache brings a few benefits because getting data from the Redis cache:

  • is faster than getting it from the primary database.
  • remove unnecessary pressure on the primary database.

Check the Redis cache page to go further.