2014-10-17 12:09:37 +02:00
|
|
|
title: Resource Usage
|
|
|
|
summary: Manage SilverStripe's memory footprint and CPU usage.
|
|
|
|
|
|
|
|
# Resource Usage
|
|
|
|
|
|
|
|
SilverStripe tries to keep its resource usage within the documented limits
|
|
|
|
(see the [server requirements](../../getting_started/server_requirements)).
|
|
|
|
|
|
|
|
These limits are defined through `memory_limit` and `max_execution_time` in the PHP configuration. They can be
|
|
|
|
overwritten through `ini_set()`, unless PHP is running with the [Suhoshin Patches](http://www.hardened-php.net/)
|
|
|
|
or in "[safe mode](http://php.net/manual/en/features.safe-mode.php)".
|
|
|
|
|
|
|
|
<div class="alert" markdown="1">
|
|
|
|
Most shared hosting providers will have maximum values that can't be altered.
|
|
|
|
</div>
|
|
|
|
|
|
|
|
For certain tasks like synchronizing a large `assets/` folder with all file and folder entries in the database, more
|
|
|
|
resources are required temporarily. In general, we recommend running resource intensive tasks through the
|
|
|
|
[command line](../cli), where configuration defaults for these settings are higher or even unlimited.
|
|
|
|
|
|
|
|
<div class="info" markdown="1">
|
2017-06-22 12:50:45 +02:00
|
|
|
SilverStripe can request more resources through `Environment::increaseMemoryLimitTo()` and
|
|
|
|
`Environment::increaseTimeLimitTo()` functions.
|
2014-10-17 12:09:37 +02:00
|
|
|
</div>
|
|
|
|
|
2017-08-03 02:51:32 +02:00
|
|
|
```php
|
2017-10-27 04:38:27 +02:00
|
|
|
use SilverStripe\Core\Environment;
|
|
|
|
|
|
|
|
public function myBigFunction()
|
|
|
|
{
|
|
|
|
Environment::increaseTimeLimitTo(400);
|
|
|
|
}
|
|
|
|
```
|