# Cache control via cli on Linux

**URL:** <https://forum.acestream.media/t/cache-control-via-cli-on-linux/3758>\
**Category:** Questions, proposals and requests\
**Created:** [15.Январь.2024 09:58:03 UTC](https://forum.acestream.media/t/cache-control-via-cli-on-linux/3758 "2024-01-15T09:58:03Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![djary](https://forum.acestream.media/letter_avatar_proxy/v4/letter/d/ac8455/32.png) [@djary](https://forum.acestream.media/u/djary)\
**Post date:** [15.Январь.2024 09:58:03 UTC](https://forum.acestream.media/t/cache-control-via-cli-on-linux/3758/1 "2024-01-15T09:58:03Z")

</div>

Привет! Не могу разобраться с параметрами, управляющими настройками кэша в cli. Хочу явно задать максимальный размер кэша и директорию на диске, но не очень выходит - в любом случае папка с кэшем /.acestream\_cache/ всегда превышает задаваемый лимит. Пробовал запускать start-engine с разными параметрами, описанными вот тут [Command Line Options - Ace Stream DAO](https://docs.acestream.net/developers/engine-command-line-options/), но все тщетно. Также заметил, что ./start-engine --help выдает другой, расширенный набор параметров. Подскажите, как правильно управлять кэшом в cli? И можно ли вообще выключить кэширование на диск и использовать только память?

---

<div class="post-metadata">

**Author:** ![Benny](https://forum.acestream.media/letter_avatar_proxy/v4/letter/b/49beb7/32.png) [@Benny](https://forum.acestream.media/u/Benny)\
**Post date:** [16.Январь.2024 12:51:11 UTC](https://forum.acestream.media/t/cache-control-via-cli-on-linux/3758/2 "2024-01-16T12:51:11Z")

</div>

Для начала нужно понять, действительно ли заданный из CLI лимит применился - см. [Ace Stream 3.1 for Ubuntu (ru/en) - #112 от пользователя Pljushevij](https://forum.acestream.media/t/ace-stream-3-1-for-ubuntu-ru-en/3359/112)  
Плюс нужно учитывать, что если движок “видит”, что свободного места на диске больше, чем задано в кеше, то он может использовать его во время активной сессии - за это, по идее, отвечает параметр “disk\_cache\_auto”, но применительно к свежим версиям нужно уточнять.

Т.е алгоритм простой - запускаем движок с указанием лимита кеша из ком. строки или .conf файла, и затем проверяем - применился он или нет.  
Проверяем так, например:

```auto
curl http://host:6878/webui/app/TOKEN/settings/get | jq . | grep cache

```

где “host” это имя хоста/адрес ПК с запущенным движком, а “TOKEN” - заранее заданный токен доступа (см, например [https://forum.acestream.media/t/i-want-to-acces-to-control-pannel-again/](https://forum.acestream.media/t/i-want-to-acces-to-control-pannel-again/))  
Выхлоп должен быть похож на:

```auto
  "vod_cache_type": "disk",
  "disk_cache_limit": 10737418240,
  "live_cache_type": "memory",
  "disk_cache_auto": true,
  "memory_cache_limit": 831516876,
  "cache_dir": "/opt/acestream/cache",

```

Как минимум, цифры лимитов должны соответствовать тем, что заданы через CLI. Плюс можно поиграться с “disk\_cache\_auto” - установить его в 0 (curl [http://host:6878/webui/app/TOKEN/settings/set?disk\_cache\_auto=0](http://host:6878/webui/app/TOKEN/settings/set?disk_cache_auto=0)) и проверить, изменится ли поведение с нарушением лимитов кеша.

> [@djary](#):
>
> И можно ли вообще выключить кэширование на диск и использовать только память?

Можно, “–vod-cache-type memory”

---

<div class="post-metadata">

**Author:** ![djary](https://forum.acestream.media/letter_avatar_proxy/v4/letter/d/ac8455/32.png) [@djary](https://forum.acestream.media/u/djary)\
**Post date:** [16.Январь.2024 20:56:51 UTC](https://forum.acestream.media/t/cache-control-via-cli-on-linux/3758/3 "2024-01-16T20:56:51Z")

</div>

Спасибо! Буду пробовать

---

<div class="post-metadata">

**Author:** ![boogiepop](https://forum.acestream.media/user_avatar/forum.acestream.media/boogiepop/32/2204_2.png) [@boogiepop](https://forum.acestream.media/u/boogiepop)\
**Post date:** [09.Июнь.2024 11:49:33 UTC](https://forum.acestream.media/t/cache-control-via-cli-on-linux/3758/4 "2024-06-09T11:49:33Z")

</div>

using latest `version:3.2.3 revision:be4471a`

when i set the live/vod cache to disk and set the the limit the 1G, the cache keeps growing.

`acestream-engine --live-cache-type disk --vod-cache-type disk --disk-cache-limit 1073741824 --state-dir /var/lib/ACEStream --log-file /var/lib/ACEStream/acestream-engine.log`

```auto
 --live-disk-cache-size LIVE_DISK_CACHE_SIZE
                        Disk cache max size in bytes

```

the command line states that the unit is bytes, in case it is wrong and gb, i tried below still the issue is same.

`acestream-engine --live-cache-type disk --vod-cache-type disk --disk-cache-limit 1 --state-dir /var/lib/ACEStream --log-file /var/lib/ACEStream/acestream-engine.log`

when i set the cache to use memory then the memory is continously filled and get OOM.

how is that supposed to work?

---

<div class="post-metadata">

**Author:** ![Benny](https://forum.acestream.media/letter_avatar_proxy/v4/letter/b/49beb7/32.png) [@Benny](https://forum.acestream.media/u/Benny)\
**Post date:** [09.Июнь.2024 14:38:07 UTC](https://forum.acestream.media/t/cache-control-via-cli-on-linux/3758/5 "2024-06-09T14:38:07Z")

</div>

See messages above - first you need to be sure that limits from CLI has actually applied - so setup access token and check actual values via HTTP API.

> [@boogiepop](#):
>
> the memory is continously filled and get OOM.

This is not normal, what running environment is for Ace Stream engine - OS/Python version, server is bare metal, VM, container?  
Are you using Ace Stream engine as client or as server (for broadcasting)?

---

<div class="post-metadata">

**Author:** ![boogiepop](https://forum.acestream.media/user_avatar/forum.acestream.media/boogiepop/32/2204_2.png) [@boogiepop](https://forum.acestream.media/u/boogiepop)\
**Post date:** [09.Июнь.2024 20:11:44 UTC](https://forum.acestream.media/t/cache-control-via-cli-on-linux/3758/6 "2024-06-09T20:11:44Z")

</div>

i digged deeper in the OOM issue it was due to another process consuming it yet i was confused.

acestream running as client, on a memory limited device (2gb) and with a mmcblock which is prune to wearing. so using memory is best option for my use case and i changed to use memory for caching.

when i give 50MB \* 1024 \* 1024 = 52428800bytes memory-cache-limit, i see it is not picking it up and using 833072128 bytes = 794MB.

Considering that i only have 2GB ram it is around %40 of total ram. This is too much, how can i restrict?

```bash
[tv@stb ACEStream]$ free
               total used free shared buff/cache available
Mem: 1919520 1329508 404388 258688 635620 590012
Swap: 1048572 666108 382464

```

> **conf**
>
> ```bash
> [tv@stb ACEStream]$ cat /usr/lib/acestream-engine/acestream.conf
> --stats-report-interval
> 1
> --stats-report-peers
> --slots-manager-use-cpu-limit
> 1
> --log-file
> acestream.log
> --vod-cache-type
> memory
> --live-cache-type
> memory
> --memory-cache-limit
> 52428800
> --access-token
> tv
> 
> ```

> **json**
>
> ```json
> {
> "version": "3.2.3",
> "version_code": 3020300,
> "cache_dir": "/var/lib/ACEStream",
> "disk_cache_limit": 10737418240,
> "memory_cache_limit": 833072128,
> "live_cache_type": "memory",
> "vod_cache_type": "memory",
> "download_limit": 0,
> "upload_limit": 0,
> "vod_buffer": 3,
> "live_buffer": 10,
> "max_connections": 500,
> "max_peers": 50,
> "port": 8621,
> "profile_gender": null,
> "profile_age": null,
> "output_format_live": "auto",
> "output_format_vod": "auto",
> "transcode_audio": false,
> "transcode_mp3": false,
> "transcode_ac3": false,
> "preferred_audio_language": "eng",
> "disk_cache_auto": true,
> "max_upload_slots": 10,
> "auto_slots": true,
> "epg_system_sources_enabled": true,
> "auth_method": "none",
> "login": "",
> "has_password": false,
> "auth_level": 0,
> "allow_intranet_access": 1,
> "allow_remote_access": 0,
> "allow_external_players": 1,
> "allow_our_player": 1,
> "android_config": {
> "send_debug_reports": false,
> "use_acknowledged_purchase_cache": false,
> "notifications": [],
> "ad_config": {
> "show_bonus_ads_activity": false,
> "max_ads": 2,
> "ima_sdk_handler_delay": 250,
> "providers": [
> "admob"
> ],
> "appodeal_disable_networks": [
> "admob"
> ],
> "admob_rewarded_video_default_segment": 50,
> "admob_rewarded_video_auto_segment": 50,
> "admob_interstitial_background_load_interval": 10000,
> "admob_rewarded_video_segments": [],
> "load_timeout": {
> "admob_interstitial_preroll": 3000,
> "admob_interstitial_pause": 3000,
> "admob_interstitial_close": 3000,
> "appodeal_interstitial": 3000,
> "admob_rv": 3000,
> "appodeal_rv": 3000,
> "admob_banner": 5000,
> "appodeal_banner": 5000,
> "vast": 60000,
> "preroll_interstitial_with_vast": 1000
> },
> "min_impression_interval": {
> "preroll": 1000,
> "pause": 10000,
> "unpause": 1000,
> "close": 10000
> },
> "custom_ads_rv_providers": [
> "admob_rv"
> ],
> "priorities": {
> "preroll": [
> [
> "vast"
> ],
> [
> "custom"
> ],
> [
> "admob_interstitial_preroll"
> ]
> ],
> "pause": [
> [
> "admob_interstitial_pause"
> ]
> ],
> "unpause": [
> [
> "vast"
> ]
> ],
> "close": [
> [
> "admob_interstitial_close"
> ]
> ],
> "main_screen_non_registered": [
> []
> ],
> "main_screen_registered": [
> []
> ]
> }
> }
> }
> }
> 
> ```

os is archlinux with pkgbuild: [AUR (en) - acestream-engine](https://aur.archlinux.org/packages/acestream-engine)

---

<div class="post-metadata">

**Author:** ![Benny](https://forum.acestream.media/letter_avatar_proxy/v4/letter/b/49beb7/32.png) [@Benny](https://forum.acestream.media/u/Benny)\
**Post date:** [09.Июнь.2024 21:10:01 UTC](https://forum.acestream.media/t/cache-control-via-cli-on-linux/3758/7 "2024-06-09T21:10:01Z")

</div>

Ok, now you may try to set memory limits via HTTP API:  
`curl "http://host:6878/webui/app/TOKEN/settings/set?memory_cache_limit=52428800"`  
and check again after engine restart - this value should be preserved.

---

<div class="post-metadata">

**Author:** ![boogiepop](https://forum.acestream.media/user_avatar/forum.acestream.media/boogiepop/32/2204_2.png) [@boogiepop](https://forum.acestream.media/u/boogiepop)\
**Post date:** [09.Июнь.2024 21:13:43 UTC](https://forum.acestream.media/t/cache-control-via-cli-on-linux/3758/8 "2024-06-09T21:13:43Z")

</div>

ah ok, you mentioned to set the limits over the json interface. Now i set it, and it is accepted. But why command line argument is ignored?

---

<div class="post-metadata">

**Author:** ![Benny](https://forum.acestream.media/letter_avatar_proxy/v4/letter/b/49beb7/32.png) [@Benny](https://forum.acestream.media/u/Benny)\
**Post date:** [09.Июнь.2024 23:11:36 UTC](https://forum.acestream.media/t/cache-control-via-cli-on-linux/3758/9 "2024-06-09T23:11:36Z")

</div>

> [@boogiepop](#):
>
> But why command line argument is ignored?

This is old “feature bug”, which came from desktop version of Ace Stream - some setting, which stored in .pickle file (set via UI or HTTP API) have higher priority, than CLI or .conf file. This issue should be addressed in the upcoming versions.
