473,480 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Python, COM Servers, and Multi-Threading

I have been considering using Python and the Reportlab library for
generating PDF reports for the back-end of a web based application. The
application runs most of its background tasks on a dedicated server that is
Windows based (Win2K or Win2k3). The program that launches the tasks
requires a COM-based interface, so I wrote a Python COM server using Mark
Hammond's PythonCom libraries and import and run the reporlab modules from
there.

I had been reading up on Python and it's handling of the multiple threads,
specifically the Global Interpreter Lock (GIL). I got to wondering if a
multi-processor machine machine would be able to take advantage of its
extra processing power using this setup. I am guessing that the GIL is
global with respect to each instance of a running Python interpreter, so if
say 4 interpreters were running, a 4 processor machine would be able to
take advantage of this. However, I am not quite sure how launching my
reports via COM behaves-- if I launched 4 reports this way, would that be
like launching 4 seperate instances of the Python interpreter, or would it
be just a single instance, and therefore run into the limitations of the
GIL? If so, can anybody offer suggestions as to a design that would be
better able to take advantage of a multi-processor machine?

Thanks,
Carl Waldbieser

Oct 10 '05 #1
1 2080
Carl Waldbieser wrote:
I have been considering using Python and the Reportlab library for
generating PDF reports for the back-end of a web based application. The
application runs most of its background tasks on a dedicated server that is
Windows based (Win2K or Win2k3). The program that launches the tasks
requires a COM-based interface, so I wrote a Python COM server using Mark
Hammond's PythonCom libraries and import and run the reporlab modules from
there.
Have you selected a specific threading model for your COM server? This
will affect how hardware resource are allocated as well as how sharing
takes place between different uses.
I had been reading up on Python and it's handling of the multiple threads,
specifically the Global Interpreter Lock (GIL). I got to wondering if a
multi-processor machine machine would be able to take advantage of its
extra processing power using this setup. I am guessing that the GIL is
global with respect to each instance of a running Python interpreter, so if
say 4 interpreters were running, a 4 processor machine would be able to
take advantage of this. However, I am not quite sure how launching my
reports via COM behaves-- if I launched 4 reports this way, would that be
like launching 4 seperate instances of the Python interpreter, or would it
be just a single instance, and therefore run into the limitations of the
GIL? If so, can anybody offer suggestions as to a design that would be
better able to take advantage of a multi-processor machine?

I am certainly no expert on COM threading models, but I would suspect
that if you specify you want your COM server to be in-process then you
would get a per-process interpreter.

You also need to be aware that if you trigger this stuff with IIS then
the web server itself performs thread pooling and (I believe) allocates
only one process per "application", so this may defeat your desire to
use all four processors concurrently.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Oct 11 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

220
18790
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
6
7422
by: Thomas Womack | last post by:
If I have a dual-processor hyperthreaded machine (so with four CPU contexts), will a python program distribute threads over all four logical processors? I ask because I'm fairly sure that this...
1
2864
by: Chung Jiho | last post by:
Hello, We have been deploying our web application over win2k servers. It is written in Python and uses Active Scripting to meet our requirements that it must be ASP application. So far, it was...
0
2203
by: Emile van Sebille | last post by:
QOTW (in the OS agnostic category): "There is a (very popular) Python package out there which exposes the win32 api. I'm not sure what it's called. (win32api? pythonwin? win32all?)" -- Francis...
2
4298
by: Silvana Di Martino | last post by:
My group recently received its first request for the the development of a really large and complex enterprise-level application, the kind of app that would require the use of tools like Enterprise...
0
2511
by: Phillip J. Eby | last post by:
PEP: 333 Title: Python Web Server Gateway Interface v1.0 Version: $Revision: 1.1 $ Last-Modified: $Date: 2004/08/27 17:30:09 $ Author: Phillip J. Eby <pje at telecommunity.com> Discussions-To:...
4
2197
by: Socheat Sou | last post by:
After a brief, but informative, discussion on Freenode's #zope chatroom, I was advised to consult the gurus on c.l.p. I'm working for a small company who is in desperate need to rewrite it's...
29
2740
by: Frank Millman | last post by:
Hi all I am writing a multi-user accounting/business system. Data is stored in a database (PostgreSQL on Linux, SQL Server on Windows). I have written a Python program to run on the client,...
31
7032
by: stéphane bard | last post by:
hello, my boss ask me to prefer windev to python. I have to argue - python work on multiple platform (linux, mac, windows) A good point but it didn't interest him. Because we want to choose a...
113
5181
by: John Nagle | last post by:
The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside...
0
7037
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6904
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7076
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6886
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
2990
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2976
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1294
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.