473,465 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Threading Advice

I have a web service that I believe needs to implement threading. I
have a timer setup to fire 3 requests and have them do some
calculations and send the info to the mainform. I also need the click
events on the mainform remain in real time. Through a little
experimentation it seems that I can only use 1 sub to update the form
to avoid cross threading. So maybe have the timer fire the 3 requests
and then when they are complete fire the sub to update the form. Can
anyone help point me in the right direction here?

Timer>>>3 requests>>>sub to update mainform
While keeping the mainform clicks in real time.

Thanks a lot.

Jun 9 '06 #1
7 1113
Melton,

How many threads you think there will be active and keep than in mind that
every user is running on its own thread? Are you not afraid that you will
quickly reach the maximum?

Cor

<me*****@hotmail.com> schreef in bericht
news:11*********************@h76g2000cwa.googlegro ups.com...
I have a web service that I believe needs to implement threading. I
have a timer setup to fire 3 requests and have them do some
calculations and send the info to the mainform. I also need the click
events on the mainform remain in real time. Through a little
experimentation it seems that I can only use 1 sub to update the form
to avoid cross threading. So maybe have the timer fire the 3 requests
and then when they are complete fire the sub to update the form. Can
anyone help point me in the right direction here?

Timer>>>3 requests>>>sub to update mainform
While keeping the mainform clicks in real time.

Thanks a lot.

Jun 9 '06 #2
Sorry, I think I misspoke. I am building an app on the user side to
access a webservice. I think I've figured out how to run the form
separately using BeginInvoke, but I still haven't solved the requests.
Is it even possible to send 3 at the same time or will it run 1 then
the next etc? It takes about 500ms to recieve the response and
process. So if I were able to manage to send all 3 requests at the
same time then I would probably have to put a thread.sleep(600) on the
ui update thread. Otherwise its going to take about 1.5 seconds to run
all 3 in line.

Any ideas? If I have to run them in line then I will, but I would
rather try and speed this up.

Jun 10 '06 #3

A webservice is multithreaded by design , this is taken care of by the
hosting process ( IIS )
i.ow if you multithread your client app and call a service 3 times call 2
might be sooner finished as call 1 ( or it might not )

if this is not a problem for you , you might encapsulate your calls in a
class with an id
to track wich call is fired and returned

about the UI update thingy

read the invokerequired property of the control you want to update if it is
true you need to recall the updating procedure with a delegate to
synchronize the thread
regards

Michel Posseth [MCP]

<me*****@hotmail.com> schreef in bericht
news:11*********************@h76g2000cwa.googlegro ups.com...
I have a web service that I believe needs to implement threading. I
have a timer setup to fire 3 requests and have them do some
calculations and send the info to the mainform. I also need the click
events on the mainform remain in real time. Through a little
experimentation it seems that I can only use 1 sub to update the form
to avoid cross threading. So maybe have the timer fire the 3 requests
and then when they are complete fire the sub to update the form. Can
anyone help point me in the right direction here?

Timer>>>3 requests>>>sub to update mainform
While keeping the mainform clicks in real time.

Thanks a lot.

Jun 11 '06 #4
Melton,

Don't expect that with threading you can speed up processes which have a
serial botleneck.

There cannot go more water through a pipe than its through its smallest
part.

The same is with data. Now your process takes 1.5ms. With the threads it
will take probably more just because that the throughput is interupted and
that your webservice is probably handling more users in a sequential way,
therefore you have introduced extra waittimes.

Your smallest part is not widened up by threading. (Or you should have
different independent working webservice on more locations).

Just my thought,

Cor

<me*****@hotmail.com> schreef in bericht
news:11**********************@f6g2000cwb.googlegro ups.com...
Sorry, I think I misspoke. I am building an app on the user side to
access a webservice. I think I've figured out how to run the form
separately using BeginInvoke, but I still haven't solved the requests.
Is it even possible to send 3 at the same time or will it run 1 then
the next etc? It takes about 500ms to recieve the response and
process. So if I were able to manage to send all 3 requests at the
same time then I would probably have to put a thread.sleep(600) on the
ui update thread. Otherwise its going to take about 1.5 seconds to run
all 3 in line.

Any ideas? If I have to run them in line then I will, but I would
rather try and speed this up.

Jun 11 '06 #5

IMHO in a server based architecture this is not the case Cor and i believe
that is where the TS is talking about

With SOA designs this is exact one of the few situations were multithreading
really can give you a performance benefit

regards

Michel Posseth [MCP]

"Cor Ligthert [MVP]" <no************@planet.nl> schreef in bericht
news:uq**************@TK2MSFTNGP05.phx.gbl...
Melton,

Don't expect that with threading you can speed up processes which have a
serial botleneck.

There cannot go more water through a pipe than its through its smallest
part.

The same is with data. Now your process takes 1.5ms. With the threads it
will take probably more just because that the throughput is interupted and
that your webservice is probably handling more users in a sequential way,
therefore you have introduced extra waittimes.

Your smallest part is not widened up by threading. (Or you should have
different independent working webservice on more locations).

Just my thought,

Cor

<me*****@hotmail.com> schreef in bericht
news:11**********************@f6g2000cwb.googlegro ups.com...
Sorry, I think I misspoke. I am building an app on the user side to
access a webservice. I think I've figured out how to run the form
separately using BeginInvoke, but I still haven't solved the requests.
Is it even possible to send 3 at the same time or will it run 1 then
the next etc? It takes about 500ms to recieve the response and
process. So if I were able to manage to send all 3 requests at the
same time then I would probably have to put a thread.sleep(600) on the
ui update thread. Otherwise its going to take about 1.5 seconds to run
all 3 in line.

Any ideas? If I have to run them in line then I will, but I would
rather try and speed this up.


Jun 11 '06 #6
Mischel,

Describe where I am in your opinion wrong.

Suppose I want 1000 parts of data.
I get this from a server over whatever line.
The bottleneck is mostly the line but can be of course somewhere else
Suppose I create 1000 threads to get everytime 1 piece of data.

Where is than my benefit because the data has sequential to pass the
smallest part of the pipeline (Can be by instance as well the processing
ability (speed etc) of the Server).

I know situations where it can be benefited beside what I wrote already if
there are more suppliers.

That is where there are supporting more connections per user but where the
maximum throughput per connection is limited by a certain bandwidth. Because
that stupid situation has everybody made multithreading programs for that.
Therefore I assume that in those cases in future that the connections will
be limited per user. As sample this is the fact by downloadaccelarators (As
they are using more downloadservers than it is fine, than they fall in the
category I have described in my first message).

But from what was written I had not the idea that it was about such a kind
of downloadaccelarator.

Cor
"Michel Posseth [MCP]" <MS**@posseth.com> schreef in bericht
news:e1**************@TK2MSFTNGP04.phx.gbl...

IMHO in a server based architecture this is not the case Cor and i believe
that is where the TS is talking about

With SOA designs this is exact one of the few situations were
multithreading really can give you a performance benefit

regards

Michel Posseth [MCP]

"Cor Ligthert [MVP]" <no************@planet.nl> schreef in bericht
news:uq**************@TK2MSFTNGP05.phx.gbl...
Melton,

Don't expect that with threading you can speed up processes which have a
serial botleneck.

There cannot go more water through a pipe than its through its smallest
part.

The same is with data. Now your process takes 1.5ms. With the threads it
will take probably more just because that the throughput is interupted
and that your webservice is probably handling more users in a sequential
way, therefore you have introduced extra waittimes.

Your smallest part is not widened up by threading. (Or you should have
different independent working webservice on more locations).

Just my thought,

Cor

<me*****@hotmail.com> schreef in bericht
news:11**********************@f6g2000cwb.googlegro ups.com...
Sorry, I think I misspoke. I am building an app on the user side to
access a webservice. I think I've figured out how to run the form
separately using BeginInvoke, but I still haven't solved the requests.
Is it even possible to send 3 at the same time or will it run 1 then
the next etc? It takes about 500ms to recieve the response and
process. So if I were able to manage to send all 3 requests at the
same time then I would probably have to put a thread.sleep(600) on the
ui update thread. Otherwise its going to take about 1.5 seconds to run
all 3 in line.

Any ideas? If I have to run them in line then I will, but I would
rather try and speed this up.



Jun 11 '06 #7
Well in your described situation it is indeed foolish to use multithreading
( if it is only about static data retrieval )

However what if the business logic is on the server ? ( as it is more and
more the case nowadays , thanks to webservices , remoting and COM+
architecture )

Instead of waiting for a transaction to finish you could already send or
process another piece of information
even better a "Good" programmer starts the longest running task first and
then starts all subsequent tasks in order of longest running time
in a ideal situation the total processing time on the client is now the time
of the longest running process while in a single threaded architecture
the total processing time is at least the sum of all tasks.

But indeed "most" people use multithreading / asynchronous processing in a
bad way and forget that one person running 100 meters is almost ever faster
as 10 persons running 10 meters , but as i said in some situations the
opposite is true let say we talk now about 50.000 meters who is now faster
?? ( unless he comes from Kenia or Ethiopia :-) .

So in the end it all comes down in rightly defining the solution`s
architecture

regards

Michel Posseth [MCP]



"Cor Ligthert [MVP]" <no************@planet.nl> schreef in bericht
news:%2****************@TK2MSFTNGP02.phx.gbl...
Mischel,

Describe where I am in your opinion wrong.

Suppose I want 1000 parts of data.
I get this from a server over whatever line.
The bottleneck is mostly the line but can be of course somewhere else
Suppose I create 1000 threads to get everytime 1 piece of data.

Where is than my benefit because the data has sequential to pass the
smallest part of the pipeline (Can be by instance as well the processing
ability (speed etc) of the Server).

I know situations where it can be benefited beside what I wrote already if
there are more suppliers.

That is where there are supporting more connections per user but where the
maximum throughput per connection is limited by a certain bandwidth.
Because that stupid situation has everybody made multithreading programs
for that. Therefore I assume that in those cases in future that the
connections will be limited per user. As sample this is the fact by
downloadaccelarators (As they are using more downloadservers than it is
fine, than they fall in the category I have described in my first
message).

But from what was written I had not the idea that it was about such a kind
of downloadaccelarator.

Cor
"Michel Posseth [MCP]" <MS**@posseth.com> schreef in bericht
news:e1**************@TK2MSFTNGP04.phx.gbl...

IMHO in a server based architecture this is not the case Cor and i
believe that is where the TS is talking about

With SOA designs this is exact one of the few situations were
multithreading really can give you a performance benefit

regards

Michel Posseth [MCP]

"Cor Ligthert [MVP]" <no************@planet.nl> schreef in bericht
news:uq**************@TK2MSFTNGP05.phx.gbl...
Melton,

Don't expect that with threading you can speed up processes which have a
serial botleneck.

There cannot go more water through a pipe than its through its smallest
part.

The same is with data. Now your process takes 1.5ms. With the threads it
will take probably more just because that the throughput is interupted
and that your webservice is probably handling more users in a sequential
way, therefore you have introduced extra waittimes.

Your smallest part is not widened up by threading. (Or you should have
different independent working webservice on more locations).

Just my thought,

Cor

<me*****@hotmail.com> schreef in bericht
news:11**********************@f6g2000cwb.googlegro ups.com...
Sorry, I think I misspoke. I am building an app on the user side to
access a webservice. I think I've figured out how to run the form
separately using BeginInvoke, but I still haven't solved the requests.
Is it even possible to send 3 at the same time or will it run 1 then
the next etc? It takes about 500ms to recieve the response and
process. So if I were able to manage to send all 3 requests at the
same time then I would probably have to put a thread.sleep(600) on the
ui update thread. Otherwise its going to take about 1.5 seconds to run
all 3 in line.

Any ideas? If I have to run them in line then I will, but I would
rather try and speed this up.



Jun 11 '06 #8

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

Similar topics

13
by: Varun | last post by:
Hi Friends, Department of Information Technology, Madras Institute of Technology, Anna University, India is conducting a technical symposium, Samhita. As a part of samhita, an Online Programming...
1
by: Your Friend | last post by:
Hello All, I'm having issues capturing the output from a program while using threading. Program runs ok when I run without threading. Here's my Python code and the Java class that is called by...
0
by: elcinturapartida | last post by:
Hello all, I am not sure if this question is about threading or serial i/o - it has elements of both. I'm on WinXP (desktop) and WinNT (labtop), when I run miniterm.py there is no problem both...
7
by: Tom B | last post by:
I've written the code below to try and figure out how threading works. My assumption is that when starting a new thread it would run at the same time as the original thread. Am I wrong? I've...
4
by: Gary Short | last post by:
Hello group, I'm writing a spidering app and I'd appreciate some advice on threading. My plan of attack is to have a main thread fetching the html from a list of urls in a xml file, then...
6
by: Yuk Tang | last post by:
Is there a basic guide to threading online? Something that not only talks about the syntax, but also the concept and ideas related to it. I'm still used to the school of single-thread programming,...
4
by: segue | last post by:
I’d like to control the threading for these lines of vb.net code: udpClient.Send(bytcmd, bytcmd.Length, remoteEP) 'send recordset0 Dim InBuf As Byte() = {} If InBuf.Length > 0 Then If...
2
by: akameswaran | last post by:
Admittedly this problem causes no actual functional issues aside from an occasional error message when the program exits. The error is: Unhandled exception in thread started by Error in...
0
by: =?Utf-8?B?VGlt?= | last post by:
I have written both a client (SoapClient) and server (SoapServer) application using WSE 3.0 with the TCP transport. These are completely standalone applications (the Server runs as a Windows...
4
by: =?Utf-8?B?aG5nbzAx?= | last post by:
All, I am developing a vb.net using threading.... I have a button to print a doc (it takes about 5-10 seconds to finish that process). As soon I click that button I start a thread and then I go...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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 ...

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.