# Sunstone consumes memory

**URL:** <https://forum.opennebula.io/t/sunstone-consumes-memory/4441>\
**Category:** Product Support\
**Created:** [June 13, 2017, 10:00am UTC](https://forum.opennebula.io/t/sunstone-consumes-memory/4441 "2017-06-13T10:00:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![denis-ldv](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@denis-ldv](https://forum.opennebula.io/u/denis-ldv)\
**Post date:** [June 13, 2017, 10:00am UTC](https://forum.opennebula.io/t/sunstone-consumes-memory/4441/1 "2017-06-13T10:00:10Z")

</div>

Opennebula 5.2.1

VM with frontend has 2Gb total memory

After each F5 (refresh) at Dashboard  
/usr/bin/ruby /usr/lib/one/sunstone/sunstone-server.rb  
consumes ~1% more memory up to \>50% (1Gb)

Is it normal?

---

<div class="post-metadata">

**Author:** ![DaD](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/dad/32/8466_2.png) [@DaD](https://forum.opennebula.io/u/DaD)\
**Post date:** [June 13, 2017, 1:15pm UTC](https://forum.opennebula.io/t/sunstone-consumes-memory/4441/2 "2017-06-13T13:15:49Z")

</div>

Denis Ldv [opennebula@discoursemail.com](mailto:opennebula@discoursemail.com) writes:

> Opennebula 5.2.1
> 
> VM with frontend has 2Gb total memory
> 
> After each F5 (refresh) at Dashboard  
> /usr/bin/ruby /usr/lib/one/sunstone/sunstone-server.rb  
> consumes ~1% more memory up to \>50% (1Gb)
> 
> Is it normal?

I remember asking this question on IRC, I finished by setting up  
Sunstone with Unicorn and each worker use several hundred MB of  
non-swapped memory:

```
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
oneadmin 23701 0.0 0.2 69244 13636 ? Ssl juin12 0:02 unicorn master -I /usr/lib/one/sunstone -c /etc/one/sunstone-unicorn.rb /usr/lib/one/sunstone/config.ru
oneadmin 23705 0.0 4.6 506412 282312 ? Sl juin12 0:34 \_ unicorn worker[0] -I /usr/lib/one/sunstone -c /etc/one/sunstone-unicorn.rb /usr/lib/one/sunstone/config.ru
oneadmin 23708 0.0 3.8 454020 233244 ? Sl juin12 0:36 \_ unicorn worker[1] -I /usr/lib/one/sunstone -c /etc/one/sunstone-unicorn.rb /usr/lib/one/sunstone/config.ru
oneadmin 23711 0.0 8.5 762124 520472 ? Sl juin12 0:46 \_ unicorn worker[2] -I /usr/lib/one/sunstone -c /etc/one/sunstone-unicorn.rb /usr/lib/one/sunstone/config.ru
oneadmin 23714 0.0 4.4 498352 274080 ? Sl juin12 0:47 \_ unicorn worker[3] -I /usr/lib/one/sunstone -c /etc/one/sunstone-unicorn.rb /usr/lib/one/sunstone/config.ru

```

This can result with my frontend swapping :-/

As I setup a memcached I can quite easily restart the unicorn service  
without much trouble for my users since it’s quick and they are not  
disconnected.

Regards.

---

<div class="post-metadata">

**Author:** ![denis-ldv](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@denis-ldv](https://forum.opennebula.io/u/denis-ldv)\
**Post date:** [June 16, 2017, 12:33pm UTC](https://forum.opennebula.io/t/sunstone-consumes-memory/4441/3 "2017-06-16T12:33:45Z")

</div>

Thank you for answer.

I installed memcached and unicorn as you suggested. Plus [https://github.com/kzk/unicorn-worker-killer](https://github.com/kzk/unicorn-worker-killer) for automatic worker restart after memory limit reach.

---

<div class="post-metadata">

**Author:** ![DaD](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/dad/32/8466_2.png) [@DaD](https://forum.opennebula.io/u/DaD)\
**Post date:** [June 20, 2017, 7:18am UTC](https://forum.opennebula.io/t/sunstone-consumes-memory/4441/4 "2017-06-20T07:18:10Z")

</div>

Denis Ldv [opennebula@discoursemail.com](mailto:opennebula@discoursemail.com) writes:

> Thank you for answer.
> 
> I installed memcached and unicorn as you suggested.

You are welcome. I said I should blog about the unicorn setup with  
systemd services & co. but I never take the time to do it :-/

> Plus [GitHub - kzk/unicorn-worker-killer: Automatically restart Unicorn workers based on 1) max number of requests and 2) max memory](https://github.com/kzk/unicorn-worker-killer) for automatic  
> restart after memory limit reach.

Thanks, I was not aware of this one.

Regards.

---

<div class="post-metadata">

**Author:** ![sulaweyo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/sulaweyo/32/4708_2.png) [@sulaweyo](https://forum.opennebula.io/u/sulaweyo)\
**Post date:** [September 11, 2017, 1:32pm UTC](https://forum.opennebula.io/t/sunstone-consumes-memory/4441/5 "2017-09-11T13:32:17Z")

</div>

I see this is a workaround but did anybody actually try to fix the memleak?  
I have that on sunstone and on econe as well and while i don’t have a problem restarting sunstone i have problems restarting econe as i have constant load on it.

Had it on 5.2 and just added more memory but on 5.4 in ha this gets a bit excessive as i have 3 nodes where i have to increase memory.
