Path: csiph.com!usenet.pasdenom.info!gegeweb.org!news.ecp.fr!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'arguments': 0.07; 'pypy': 0.07; 'space.': 0.07; 'python': 0.09; 'buffer.': 0.09; 'deletion': 0.09; 'friday,': 0.09; 'stl': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; '"free"': 0.16; '4-byte': 0.16; 'arrays.': 0.16; 'blocks': 0.16; 'did,': 0.16; 'help?': 0.16; 'processes.': 0.16; 'segment': 0.16; 'structures,': 0.16; 'tier': 0.16; 'wrote:': 0.17; 'bytes': 0.17; 'integer': 0.17; 'thanks,': 0.18; 'memory': 0.18; 'requests': 0.18; '(or': 0.18; 'windows': 0.19; '31,': 0.22; 'amounts': 0.22; 'libraries': 0.22; 'names.': 0.22; 'plus.': 0.22; 'cc:2**0': 0.23; 'somebody': 0.23; 'cc:no real name:2**0': 0.24; 'linux': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'creating': 0.26; 'values': 0.26; 'core': 0.27; 'disk': 0.27; 'structures': 0.27; "doesn't": 0.28; 'there.': 0.28; 'developing': 0.28; 'run': 0.28; 'arrays': 0.29; "i'm": 0.29; 'e.g.': 0.30; 'file': 0.32; 'operate': 0.32; 'space,': 0.32; 'running': 0.32; 'could': 0.32; "aren't": 0.33; 'times.': 0.33; 'another': 0.33; 'received:google.com': 0.34; 'minimum': 0.34; 'server': 0.35; 'list': 0.35; 'locations': 0.35; 'doing': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'ability': 0.36; 'serve': 0.36; 'but': 0.36; 'alone': 0.36; 'modules': 0.36; 'should': 0.36; 'operating': 0.36; 'received:209': 0.37; 'received:209.85.216': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'object': 0.38; 'nothing': 0.38; 'system.': 0.39; 'space': 0.39; 'short': 0.39; 'application': 0.40; 'your': 0.60; 'address': 0.60; 'most': 0.61; 'stand': 0.61; 'free': 0.61; 'more.': 0.62; 'provide': 0.62; 'different': 0.63; 'times': 0.63; 'within': 0.64; 'become': 0.65; 'august': 0.66; 'yourself': 0.77; 'computers.': 0.84; 'conducive': 0.84; 'multi-tier': 0.84; 'nagy': 0.84; 'received:209.85.216.184': 0.84; 'routines': 0.84; 'prone': 0.91; 'clients,': 0.95 Newsgroups: comp.lang.python Date: Sat, 1 Sep 2012 19:10:43 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=67.184.78.189; posting-account=MQ3pigoAAACeFzUFjVAePnOjOJMNlvq9 References: User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 67.184.78.189 MIME-Version: 1.0 Subject: Re: Looking for an IPC solution From: Aaron Brady To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 62 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346551846 news.xs4all.nl 6899 [2001:888:2000:d::a6]:41731 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28228 On Friday, August 31, 2012 2:22:00 PM UTC-5, Laszlo Nagy wrote: > There are just so many IPC modules out there. I'm looking for a solution= =20 >=20 > for developing a new a multi-tier application. The core application will= =20 >=20 > be running on a single computer, so the IPC should be using shared=20 >=20 > memory (or mmap) and have very short response times. But there will be a= =20 >=20 > tier that will hold application state for clients, and there will be=20 >=20 > lots of clients. So that tier needs to go to different computers. E.g.=20 >=20 > the same IPC should also be accessed over TCP/IP. Most messages will be= =20 >=20 > simple data structures, nothing complicated. The ability to run on PyPy= =20 >=20 > would, and also to run on both Windows and Linux would be a plus. >=20 >=20 >=20 > I have seen a stand alone cross platform IPC server before that could=20 >=20 > serve "channels", and send/receive messages using these channels. But I= =20 >=20 > don't remember its name and now I cannot find it. Can somebody please hel= p? >=20 >=20 >=20 > Thanks, >=20 >=20 >=20 > Laszlo Hi Laszlo, There aren't a lot of ways to create a Python object in an "mmap" buffer. = "mmap" is conducive to arrays of arrays. For variable-length structures li= ke strings and lists, you need "dynamic allocation". The C functions "mall= oc" and "free" allocate memory space, and file creation and deletion routin= es operate on disk space. However "malloc" doesn't allow you to allocate m= emory space within memory that's already allocated. Operating systems don'= t provide that capability, and doing it yourself amounts to creating your o= wn file system. If you did, you still might not be able to use existing li= braries like the STL or Python, because one address might refer to differen= t locations in different processes. One solution is to keep a linked list of free blocks within your "mmap" buf= fer. It is prone to slow access times and segment fragmentation. Another = solution is to create many small files with fixed-length names. The minimu= m file size on your system might become prohibitive depending on your const= raints, since a 4-byte integer could occupy 4096 bytes on disk or more. Or= you can serialize the arguments and return values of your functions, and m= ake requests to a central process.