Multi-Threading

Discussion in 'ASP .Net' started by Alan T, Jul 13, 2010.

  1. Alan T

    Alan T Guest

    Just wanted to know if I can do this:

    1) User click a button on a page
    2) It creates a thread
    3) The thread will generate a report
    4) This process may take up to a couple of minutes. eg. 5 minutes
    5) Before the process finish the client exit and close the browser
    6) The process will still keep doing its job until the report/file is
    generated

    Do you think it is possible?

    The reason I am think of this way is the user does not need to wait for the
    5 minutes keep the browser opening in blank mode.
    Alan T, Jul 13, 2010
    #1
    1. Advertising

  2. On Tue, 13 Jul 2010 10:36:41 +1000, "Alan T"
    <> wrote:

    >Just wanted to know if I can do this:
    >
    >1) User click a button on a page
    >2) It creates a thread
    >3) The thread will generate a report
    >4) This process may take up to a couple of minutes. eg. 5 minutes
    >5) Before the process finish the client exit and close the browser
    >6) The process will still keep doing its job until the report/file is
    >generated
    >
    >Do you think it is possible?
    >

    It is possible to do but what happens to the report after it has been
    generated and the client-server connection no longer exists? If the
    report gets written to some datastore for later retrieval, you're
    adding some unnecessary complexity. Just have the web app hand the
    request off to service that writes the generated report to a datastore
    which is visible to both the service and web app.

    >The reason I am think of this way is the user does not need to wait for the
    >5 minutes keep the browser opening in blank mode.
    >

    If this _has_ to be done in browser in real-time I would consider
    using an asynchronous request. Even so 'couple of minutes' will seem
    like an eternity to the user.

    regards
    A.G.
    Registered User, Jul 13, 2010
    #2
    1. Advertising

  3. Alan T

    Alan T Guest

    >>Just wanted to know if I can do this:
    >>
    >>1) User click a button on a page
    >>2) It creates a thread
    >>3) The thread will generate a report
    >>4) This process may take up to a couple of minutes. eg. 5 minutes
    >>5) Before the process finish the client exit and close the browser
    >>6) The process will still keep doing its job until the report/file is
    >>generated
    >>
    >>Do you think it is possible?
    >>

    > It is possible to do but what happens to the report after it has been
    > generated and the client-server connection no longer exists? If the
    > report gets written to some datastore for later retrieval, you're
    > adding some unnecessary complexity. Just have the web app hand the
    > request off to service that writes the generated report to a datastore
    > which is visible to both the service and web app.


    I just wonder if there is a 'global' thread can be created, does not attach
    to any 'session' or user connection.
    Can this 'global' thread be created outside the web page (eg. outside
    mainpag.cs), such as in GlobalThread.cs?


    >>The reason I am think of this way is the user does not need to wait for
    >>the
    >>5 minutes keep the browser opening in blank mode.
    >>

    > If this _has_ to be done in browser in real-time I would consider
    > using an asynchronous request. Even so 'couple of minutes' will seem
    > like an eternity to the user.


    Yes, this is another option I am thinking of.
    I will create a table storing the report request from the web page, eg. has
    table fields:
    ReportName
    ReportParameters
    ClientName
    DateRquested

    Then write a windows service that continuously scan through this table to
    generate the requested report and save to harddisk.
    Alan T, Jul 15, 2010
    #3
  4. Alan T

    Cubaman Guest

    On Jul 13, 2:36 am, "Alan T" <> wrote:
    > Just wanted to know if I can do this:
    >
    > 1) User click a button on a page
    > 2) It creates a thread
    > 3) The thread will generate a report
    > 4) This process may take up to a couple of minutes. eg. 5 minutes
    > 5) Before the process finish the client exit and close the browser
    > 6) The process will still keep doing its job until the report/file is
    > generated
    >
    > Do you think it is possible?
    >
    > The reason I am think of this way is the user does not need to wait for the
    > 5 minutes keep the browser opening in blank mode.


    I think that you should try Sql Reporting Services. It comes with Sql
    2005 for free, and can generate reports in push or pull mode.
    http://technet.microsoft.com/en-us/library/cc917530.aspx
    Best regards.
    Cubaman, Jul 15, 2010
    #4
  5. Alan T

    Alan T Guest

    Hi,

    Unlucky, as we are using MySQL as backend.

    Also a question in my situation:
    - we got 80 reports
    - each report have different parameters (filters, may be 4 or 5 filters)
    - for my second option (write a Windows service scanning through the table)
    - if I store each type of report request in its own table, there will be 80
    tables with one master table(the queue) which points to each possible report
    table (one of those 80 tables)
    - if I use 1 big table as request queue, there will be about 30 fields
    storing the parameters (many of the parameter fields will be empty, first
    normalisation, but I don't mind this)

    "Cubaman" <> wrote in message
    news:...
    On Jul 13, 2:36 am, "Alan T" <> wrote:
    > Just wanted to know if I can do this:
    >
    > 1) User click a button on a page
    > 2) It creates a thread
    > 3) The thread will generate a report
    > 4) This process may take up to a couple of minutes. eg. 5 minutes
    > 5) Before the process finish the client exit and close the browser
    > 6) The process will still keep doing its job until the report/file is
    > generated
    >
    > Do you think it is possible?
    >
    > The reason I am think of this way is the user does not need to wait for
    > the
    > 5 minutes keep the browser opening in blank mode.


    I think that you should try Sql Reporting Services. It comes with Sql
    2005 for free, and can generate reports in push or pull mode.
    http://technet.microsoft.com/en-us/library/cc917530.aspx
    Best regards.
    Alan T, Jul 16, 2010
    #5
  6. Alan T

    Cubaman Guest

    On Jul 16, 2:14 am, "Alan T" <> wrote:
    > Hi,
    >
    > Unlucky, as we are using MySQL as backend.
    >
    > Also a question in my situation:
    > - we got 80 reports
    > - each report have different parameters (filters, may be 4 or 5 filters)
    > - for my second option (write a Windows service scanning through the table)
    > - if I store each type of report request in its own table, there will be 80
    > tables with one master table(the queue) which points to each possible report
    > table (one of those 80 tables)
    > - if I use 1 big table as request queue, there will be about 30 fields
    > storing the parameters (many of the parameter fields will be empty, first
    > normalisation, but I don't mind this)
    >
    > "Cubaman" <> wrote in message
    >
    > news:...
    > On Jul 13, 2:36 am, "Alan T" <> wrote:
    >
    > > Just wanted to know if I can do this:

    >
    > > 1) User click a button on a page
    > > 2) It creates a thread
    > > 3) The thread will generate a report
    > > 4) This process may take up to a couple of minutes. eg. 5 minutes
    > > 5) Before the process finish the client exit and close the browser
    > > 6) The process will still keep doing its job until the report/file is
    > > generated

    >
    > > Do you think it is possible?

    >
    > > The reason I am think of this way is the user does not need to wait for
    > > the
    > > 5 minutes keep the browser opening in blank mode.

    >
    > I think that you should try Sql Reporting Services. It comes with Sql
    > 2005 for free, and can generate reports in push or pull mode.http://technet.microsoft.com/en-us/library/cc917530.aspx
    > Best regards.


    Dont store reports in ddbb, but in file system. Just save the path an
    other relative data in ddbb. Is the most common aproach.
    Best regards.
    Cubaman, Jul 16, 2010
    #6
  7. Alan T

    Alan T Guest

    > Also a question in my situation:
    > - we got 80 reports
    > - each report have different parameters (filters, may be 4 or 5 filters)
    > - for my second option (write a Windows service scanning through the
    > table)
    > - if I store each type of report request in its own table, there will be
    > 80
    > tables with one master table(the queue) which points to each possible
    > report
    > table (one of those 80 tables)
    > - if I use 1 big table as request queue, there will be about 30 fields
    > storing the parameters (many of the parameter fields will be empty, first
    > normalisation, but I don't mind this)


    Dont store reports in ddbb, but in file system. Just save the path an
    other relative data in ddbb. Is the most common aproach.
    Best regards.


    Hi,

    Yes, I saved the exported reports in file system in .pdf format.
    What I will save the report requests in table.

    eg.
    Master table:
    ID
    RequestUser
    RequestDate
    RequestReport ID
    HasSaved
    HasStarted

    Detail report request table:
    ReportID
    ReportName
    EmployeeID
    Start Date
    End Date
    .......
    .......
    Filter30

    So as each report will have about 4 filters (eg. DateFrom, DateTo,
    EmployeeID, ...etc)
    Most of the Filters fields will be empty.

    My service will scan through the master table to see if any of the requests
    had started and saved., set a flag if yes.
    Then look for the details table for the filters and generated the report.

    eg.
    Generate Employee report, will take the EmployeeID, Start Date and End Date
    for the report filters.
    Alan T, Jul 19, 2010
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    38
    Views:
    1,252
    Dennis Lee Bieber
    Feb 15, 2005
  2. Replies:
    9
    Views:
    1,001
    Mark Space
    Dec 29, 2007
  3. Steven Woody
    Replies:
    0
    Views:
    393
    Steven Woody
    Jan 9, 2009
  4. Steven Woody
    Replies:
    0
    Views:
    428
    Steven Woody
    Jan 9, 2009
  5. akineko
    Replies:
    3
    Views:
    2,589
    Jesse Noller
    Jan 29, 2009
Loading...

Share This Page