473,796 Members | 2,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Nebi-Question: Database-Cronjob or Threading-Solution

Hi,

in a webapplication, after a submit a page is called which is processing
images uploaded by the user. currently after submit a status bar will be
visible (the page for the image processing runs in an iframe) and after
image processing the page makes an redirect. if there are many images, the
processing needs some time and if the user is closing the browser the
processing will be interrupted.

now i would like to source out the image-processing to make it
"barrier-free". my idea was to write after submit the sessionId (foldername
with images = sessionId) to a database and read the database with a cronjob
to process the images.

i have heard from threading and that it should be possible to store a thread
in memory even if the user is closing the browser. is it true, that a
method-call can be saved in a thread, or would the database-cronjob-solution
be better?

thank you very much.

Regards,
Christian
Oct 19 '08 #1
5 1574
"Christian Schlemmer" <ch************ *****@iplace.at wrote in message
news:ew******** *****@TK2MSFTNG P02.phx.gbl...
in a webapplication, after a submit a page is called which is processing
images uploaded by the user. currently after submit a status bar will be
visible (the page for the image processing runs in an iframe) and after
image processing the page makes an redirect. if there are many images, the
processing needs some time and if the user is closing the browser the
processing will be interrupted.

now i would like to source out the image-processing to make it
"barrier-free". my idea was to write after submit the sessionId
(foldername with images = sessionId) to a database and read the database
with a cronjob to process the images.

i have heard from threading and that it should be possible to store a
thread in memory even if the user is closing the browser. is it true, that
a method-call can be saved in a thread, or would the
database-cronjob-solution be better?
Well, you *can* create a Thread from the code-behind of a web page, and
the thread will continue to run after the page has been unloaded. However,
this will not scale well. If you have lots of users and your code continues
spawning threads on the server, you are likely to bring the server down.
The alternative is better, i.e., enqueue all the processing requests,
regardless of which mechanism you use to suport the queue (a table in a
database, or a set of files on disk, or MSMQ, or Sql Server Service Broker),
and then run a single process to dequeue and process the request.
We don't have "cron" on Windows; the equivalent would be the windows
scheduler, but for this application I think that it would be better to write
a Windows Service and have the service listen to the queue and process the
jobs as soon as they arrive.

Oct 19 '08 #2
Thank you very much for your helpfull response.
"Alberto Poblacion" <ea************ *************** ***@poblacion.o rgschrieb
im Newsbeitrag news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
"Christian Schlemmer" <ch************ *****@iplace.at wrote in message
news:ew******** *****@TK2MSFTNG P02.phx.gbl...
>in a webapplication, after a submit a page is called which is processing
images uploaded by the user. currently after submit a status bar will be
visible (the page for the image processing runs in an iframe) and after
image processing the page makes an redirect. if there are many images,
the processing needs some time and if the user is closing the browser the
processing will be interrupted.

now i would like to source out the image-processing to make it
"barrier-free". my idea was to write after submit the sessionId
(foldername with images = sessionId) to a database and read the database
with a cronjob to process the images.

i have heard from threading and that it should be possible to store a
thread in memory even if the user is closing the browser. is it true,
that a method-call can be saved in a thread, or would the
database-cronjob-solution be better?

Well, you *can* create a Thread from the code-behind of a web page, and
the thread will continue to run after the page has been unloaded. However,
this will not scale well. If you have lots of users and your code
continues spawning threads on the server, you are likely to bring the
server down.
The alternative is better, i.e., enqueue all the processing requests,
regardless of which mechanism you use to suport the queue (a table in a
database, or a set of files on disk, or MSMQ, or Sql Server Service
Broker), and then run a single process to dequeue and process the request.
We don't have "cron" on Windows; the equivalent would be the windows
scheduler, but for this application I think that it would be better to
write a Windows Service and have the service listen to the queue and
process the jobs as soon as they arrive.

Oct 19 '08 #3
i did some research and have some questions i would like to ask:

Do you mean the Queue-Class form System.Collecti ons with its methods Enqueue
and Dequeue?
The single process to dequeue and process the request is the
Windows-Service, right?
summing up, if i understood correct it works like follows: After submit a
job is enqueued to a queue-object (regardless if the user is closing the
browser it will be reside in memory) and a Windows Service is listening if
there are objects ob type queue in the memory and if yes it starts to deqeue
the objects, right?

Thank you & regards


"Alberto Poblacion" <ea************ *************** ***@poblacion.o rgschrieb
im Newsbeitrag news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
"Christian Schlemmer" <ch************ *****@iplace.at wrote in message
news:ew******** *****@TK2MSFTNG P02.phx.gbl...
>in a webapplication, after a submit a page is called which is processing
images uploaded by the user. currently after submit a status bar will be
visible (the page for the image processing runs in an iframe) and after
image processing the page makes an redirect. if there are many images,
the processing needs some time and if the user is closing the browser the
processing will be interrupted.

now i would like to source out the image-processing to make it
"barrier-free". my idea was to write after submit the sessionId
(foldername with images = sessionId) to a database and read the database
with a cronjob to process the images.

i have heard from threading and that it should be possible to store a
thread in memory even if the user is closing the browser. is it true,
that a method-call can be saved in a thread, or would the
database-cronjob-solution be better?

Well, you *can* create a Thread from the code-behind of a web page, and
the thread will continue to run after the page has been unloaded. However,
this will not scale well. If you have lots of users and your code
continues spawning threads on the server, you are likely to bring the
server down.
The alternative is better, i.e., enqueue all the processing requests,
regardless of which mechanism you use to suport the queue (a table in a
database, or a set of files on disk, or MSMQ, or Sql Server Service
Broker), and then run a single process to dequeue and process the request.
We don't have "cron" on Windows; the equivalent would be the windows
scheduler, but for this application I think that it would be better to
write a Windows Service and have the service listen to the queue and
process the jobs as soon as they arrive.

Oct 19 '08 #4
"Christian Schlemmer" <ch************ *****@iplace.at wrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Do you mean the Queue-Class form System.Collecti ons with its methods
Enqueue and Dequeue?
No, that was not what I had in mind. The Queue class would keep the
queue items in memory inside a .Net process, so it doesn´t provide an easy
way to move the items from the web pages code-behind into the Service. But
now that you mention it, it may be a good solution, since you could keep the
queue inside the service, using a System.Collecti ons.Queue, and implement
some interprocess communication to send the requests from the web pages into
the service, which would enqueue them upon receipt, and keep a (single)
separate thread dequeuing and processing requests.
The single process to dequeue and process the request is the
Windows-Service, right?
Yes.
summing up, if i understood correct it works like follows: After submit a
job is enqueued to a queue-object (regardless if the user is closing the
browser it will be reside in memory) and a Windows Service is listening if
there are objects ob type queue in the memory and if yes it starts to
deqeue the objects, right?
Yes, after submitting a job it is immediately sent to the queue, so the
page can then be closed, and the Windows Service listens on the queue. At
first my idea was to submit the jobs to a separate storage (such as, for
example, Microsoft Message Queue Service (MSMQ)), and have the Windows
Service extract the jobs from the same storage. In this way, MSMQ (or
whatever you used in its place) would provide the communication between web
and service, without requiring a separate interprocess communication.

Oct 19 '08 #5
Hi Alberto,

Thank you very much, for your answers.

best regards,
Christian

"Alberto Poblacion" <ea************ *************** ***@poblacion.o rgschrieb
im Newsbeitrag news:es******** ******@TK2MSFTN GP03.phx.gbl...
"Christian Schlemmer" <ch************ *****@iplace.at wrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>Do you mean the Queue-Class form System.Collecti ons with its methods
Enqueue and Dequeue?

No, that was not what I had in mind. The Queue class would keep the
queue items in memory inside a .Net process, so it doesn´t provide an easy
way to move the items from the web pages code-behind into the Service. But
now that you mention it, it may be a good solution, since you could keep
the queue inside the service, using a System.Collecti ons.Queue, and
implement some interprocess communication to send the requests from the
web pages into the service, which would enqueue them upon receipt, and
keep a (single) separate thread dequeuing and processing requests.
>The single process to dequeue and process the request is the
Windows-Service, right?

Yes.
>summing up, if i understood correct it works like follows: After submit a
job is enqueued to a queue-object (regardless if the user is closing the
browser it will be reside in memory) and a Windows Service is listening
if there are objects ob type queue in the memory and if yes it starts to
deqeue the objects, right?

Yes, after submitting a job it is immediately sent to the queue, so the
page can then be closed, and the Windows Service listens on the queue. At
first my idea was to submit the jobs to a separate storage (such as, for
example, Microsoft Message Queue Service (MSMQ)), and have the Windows
Service extract the jobs from the same storage. In this way, MSMQ (or
whatever you used in its place) would provide the communication between
web and service, without requiring a separate interprocess communication.

Oct 22 '08 #6

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

Similar topics

2
1832
by: Nikola Skoric | last post by:
Hello, I'm having trouble uploading files via post method. I'm using this code for the form: <form enctype="multipart/form-data" method="POST" action="run_dodaj_alb.php"> <p>Naziv albuma:<br><input type="text" name="naziv" size="35" value="<?php if (isset($row->naziv)) echo $row->naziv; ?>"></p> <p>Godina izdanja: <input type="text" name="godina" size="4" value="<?php if (isset($row->godina)) echo $row->godina; ?>"></p>...
2
1581
by: puzo | last post by:
is it possible to test my php files from dreamweaver? i hgave installed apache server and php4.0. i can test my pages in explorer but is it possible to set dreamweaver to open php page when i click on preview?
10
10379
by: Nikola Skoric | last post by:
Hello there, Lets say I have something like this in my Mother Of All Threads: Thread thread1 = new Thread(new ThreadStart(this.run)); thread1.Start(); //some unimportant code thread1.Abort(); thread1.Join();
5
1284
by: Nikola Skoric | last post by:
Lets say I have a situation like this: public class a {         public a () {                 //...         }          public a (int i) {                 //...         } }
6
1111
by: puzo | last post by:
is it possible to convert C# application so i can run it on the computer where there is no framework?
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9524
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10449
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10168
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
7546
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.