crossbario / crossbario/autobahn-python

High Memory Consumption on Barebone WAMP Component

Open
#931 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs enhancement wamp
Dominant language
Python
Stars
2.5k
Forks
768
PR merge metrics
No merged PRs in 30d

Description

Using memory_profile I verified that a empty barebone WAMP component has a high memory consumption. Bellow the examples for Twisted and Asyncio with Cpython3, and Pypy3

Twisted code:

from os import environ
from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class MyComponent(ApplicationSession):

    def onJoin(self, details):
        print("joined")
        pass

if __name__ == '__main__':
    runner = ApplicationRunner(url=u"ws://localhost:8888/ws",
                               realm=u"RE_acct")

    runner.run(MyComponent, auto_reconnect=False)
Python3
screen shot 2017-11-23 at 17 10 25 ~35Mb of RAM
PyPy3
screen shot 2017-11-23 at 17 09 49 ~85Mb of RAM

Asyncio:

from os import environ
import asyncio
from autobahn.asyncio.wamp import ApplicationSession, ApplicationRunner

class MyComponent(ApplicationSession):    
    def onJoin(self, details):
        print("joined")
        pass

if __name__ == '__main__':
    runner = ApplicationRunner(url=u"ws://localhost:8888/ws",
                               realm=u"RE_acct")

    runner.run(MyComponent)
Python3
screen shot 2017-11-23 at 17 11 41 ~18Mb of RAM
PyPy3
screen shot 2017-11-23 at 17 12 33 ~75Mb of RAM

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported memory usage with the Twisted and asyncio ApplicationRunner examples, comparing CPython 3 and PyPy 3. Trace the ApplicationSession and runner startup paths to identify where the empty component's memory is allocated. Done means the cause is established and the reported baseline consumption is reduced or clearly documented as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.