Python Forum
performance in network host of manager in multiprocessing
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
performance in network host of manager in multiprocessing
#1
Hi
I run my own project with gunicorn (multi worker) and I wanted to share objects between processes. I used BaseManager from the multiprocessing python package. my project is Django and this is part of code:

def get_bloom_filter_shared_state():
    manager = BaseManager(
        ('127.0.0.1', '8004'),
        b'blabla'
    )
    m_bloom_filter = BloomFilter()
    a_bloom_filter = BloomFilter()

    # n_share_state: memory sharing already exists or new.
    n_share_state = False

    # register in manager
    manager.register('m_bloom_filter', lambda: m_bloom_filter)
    manager.register('a_bloom_filter', lambda: a_bloom_filter)

    try:
        manager.get_server()
        manager.start()
        n_share_state = True

    except OSError:
        # Address already in use
        manager.connect()

    return manager.m_bloom_filter(), manager.a_bloom_filter(), n_share_state
Is the performance of the network low in many requests? What is the performance of this host (127.0.0.1)?
Reply
#2
The TCP/IP Stack is fast enough to handle it. A Unix-Socket should reduce overhead.
Using a UNIX-Socket is for free and does not require many code changes.

The most overhead comes from IPC itself.
The Processes receive the data serialized with pickle and use locks around this action, to be atomic.
rmaleki likes this post
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#3
Thanks
Your hint helped me a lot.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Netmiko Program ssh from the Jumpssh ( host -> Jumphost -> Network Device matya0403 3 6,835 Jul-31-2020, 08:22 AM
Last Post: dtw
  how virtual and host can communicate? looney99 0 2,079 Nov-28-2019, 09:08 PM
Last Post: looney99
  virtual host and real network communicate looney99 3 2,868 Nov-20-2019, 12:27 PM
Last Post: ChislaineWijdeven

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020