Hello!
I have a C# ASPX page that displays a large amount of information. The
software loops through 500 lines of code (and some of the 500 lines are
looped multiple times, in a loop). Naturally, it takes approximately 7
seconds for the Page_Load event to fire (where I have all of my code).
I thought that going down the threading road would be a good idea – it cut
my execution time in half. However, sometimes the thread finishes after the
page has displayed, a bad deal. How do you generate large amounts of data,
and then display it? Are there any threading tricks?
Thanks,
JMax 3 1371
JMax,
Threading in an ASP.NET application when you only have one task to
complete (your loop) is a bad idea. The reason is that you are starting up
another thread while your processing thread (the one that returns the
response to the browser) is basically sitting around waiting (it should be
waiting, that is).
Unless you can break out the task in the loop to other threads (which
you have to wait for), there is no point in doing what you are doing. You
will have to consider what the page is doing, and see if you can offload the
processing to another process.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"JMax" <JM**@discussio ns.microsoft.co m> wrote in message
news:08******** *************** ***********@mic rosoft.com... Hello! I have a C# ASPX page that displays a large amount of information. The software loops through 500 lines of code (and some of the 500 lines are looped multiple times, in a loop). Naturally, it takes approximately 7 seconds for the Page_Load event to fire (where I have all of my code). I thought that going down the threading road would be a good idea - it cut my execution time in half. However, sometimes the thread finishes after the page has displayed, a bad deal. How do you generate large amounts of data, and then display it? Are there any threading tricks? Thanks, JMax
Hello JMax,
Are you really need to show all that data on one page? Maybe to apply asyc
calls to get dependent data? To show minumum info for user
and all dependent data (for example data in dropdown boxed) get async?
J> I have a C# ASPX page that displays a large amount of information.
J> The software loops through 500 lines of code (and some of the 500
J> lines are looped multiple times, in a loop). Naturally, it takes
J> approximately 7 seconds for the Page_Load event to fire (where I have
J> all of my code).
J>
J> I thought that going down the threading road would be a good idea -
J> it cut my execution time in half. However, sometimes the thread
J> finishes after the page has displayed, a bad deal. How do you
J> generate large amounts of data, and then display it? Are there any
J> threading tricks?
J>
J> Thanks,
J>
J> JMax
J>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
HI, I thought that going down the threading road would be a good idea - it cut my execution time in half. However, sometimes the thread finishes after the page has displayed, a bad deal. How do you generate large amounts of data, and then display it? Are there any threading tricks?
It's not a good idea, it does the opposite as a matter of fact.
You have two options:
1- try to send chuck of the page back to the client, so the client sees part
of the page whiel you are generating the rest.
2- try to show less data in your page and use pagination if possible
You do not especify details about your problem so we cannot give you better
answer, you could also use caching or maybe improve the data generation
algorithm.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Anthony_Barker |
last post by:
I have been reading a book about the evolution of the Basic
programming language. The author states that Basic - particularly
Microsoft's version is full of compromises which crept in along the
language's 30+ year evolution.
What to you think python largest compromises are?
The three that come to my mind are significant whitespace,...
|
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 Contest is scheduled on Sunday, 27 Feb 2005.
This is the first Online Programming Contest in India to support
Python !!!!.
Other languages...
|
by: Antal Rutz |
last post by:
Hi, All!
I'm new to threading. I have some design questions:
Task: I collect data and store them in an RDBMS (mysql or pgsql)
The question is how to do that with threading?
The data-collecting piece of the code runs in a thread.
1. Open the db, and each thread writes the result immediately.
(Sub-question: which is better: cursor object...
|
by: Jon Skeet [C# MVP] |
last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the
article on all the groups this is posted to.
I've finally managed to finish my article on multi-threading - at least
for the moment. I'd be *very* grateful if people with any interest in
multi-threading would read it (even just bits of it - it's somewhat
long to go...
|
by: mjheitland |
last post by:
Hi,
I like to know how many threads are used by a Threading.Timer object.
When I create a Threading.Timer object calling a short running method
every 5 seconds I expected to have one additional ThreadPool thread.
And that is exactly what MS VIsual Studio shows.
But when I run Processexplorer or Taskmanager I see 2 additional
threads,...
| |
by: Bob |
last post by:
- For cleanup, is it sufficient to set a Thread to Nothing after it's done?
- It is OK to pass objects out of the thread? (dumb question maybe but I
want to be sure)
- What's the best way to process messages coming out of a thread? I want to
queue them up, but MessageQueue doesn't look like what I need. Should I just
make my own queue...
|
by: akrapus |
last post by:
Hi,
I am trying to understand how to use threading in Python. I get
threading as a concept, but not the implementation.
In order to start threading, do you call it as a separate function,
which will then be applied to the rest of the code (functions) or do
you open threading in each function. This all can probably be answered
by 'How...
|
by: DBC User |
last post by:
I have a background process which reads a table to see if there are any
pending requests. If there are any, then it will start a worker thread
(only 10 allowed at a time) and executes a method. In this method, I
iniate a PROCESS and on completion, it reduces the available worker
thread and continue.
I have couple of questions;
1. Since I...
|
by: kimiraikkonen |
last post by:
Hello experts,
I've been already working on a project and also asked and i've managed
to create a basic Gmail mail sender, but i want to add a progressbar
that shows "sending is in progress" but when i add the
progressbar1.show() when sending then progressbar.hide() after sending
finishes, as known well progressbar is shown after sending is...
|
by: Dann Corbit |
last post by:
Rather than create a new way of doing things:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2497.html
why not just pick up ACE into the existing standard:
http://www.cse.wustl.edu/~schmidt/ACE.html
the same way that the STL (and subsequently BOOST) have been subsumed?
Since it already runs on zillions of platforms, they have...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |