Multi Threaded web Service

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stu

    Multi Threaded web Service

    Hi,

    I have a web service that does database access and calculations
    However it keeps falling over becuase its not multi threaded and each call to
    it is not in its own space!!
    I dont want to use com+ so is there any way of making it
    Multi threaded

    TIA

    Stu
  • Dilip Krishnan

    #2
    Re: Multi Threaded web Service

    Hello Stu,
    It should be... what are you trying to do and how is it failing (error
    message)

    HTH
    Regards,
    Dilip Krishnan
    MCAD, MCSD.net
    dkrishnan at geniant dot com
    Experience is the advantage. AI is the multiplier.

    [color=blue]
    > Hi,
    >
    > I have a web service that does database access and calculations
    > However it keeps falling over becuase its not multi threaded and each
    > call to
    > it is not in its own space!!
    > I dont want to use com+ so is there any way of making it
    > Multi threaded
    > TIA
    >
    > Stu
    >[/color]


    Comment

    • Stu

      #3
      Re: Multi Threaded web Service

      Hi,

      Its a calculator imagine it as a black box.
      It grabs data then shoves everything into structures then process
      and then writes back to the database

      When Its called from a batch process to process thousands of clients
      And then u call it from a web front end whilst its running you get
      index out of bound errors

      When the web service is called
      I assumed that the structures defined etc are for each call ?
      ie protected in its own apartment and hence thats why I asked the question

      it works fine as a com+ component but want to move it away from there
      without just wrapping a web service around the com+.ie pure web service





      "Dilip Krishnan" wrote:
      [color=blue]
      > Hello Stu,
      > It should be... what are you trying to do and how is it failing (error
      > message)
      >
      > HTH
      > Regards,
      > Dilip Krishnan
      > MCAD, MCSD.net
      > dkrishnan at geniant dot com
      > http://www.geniant.com
      >[color=green]
      > > Hi,
      > >
      > > I have a web service that does database access and calculations
      > > However it keeps falling over becuase its not multi threaded and each
      > > call to
      > > it is not in its own space!!
      > > I dont want to use com+ so is there any way of making it
      > > Multi threaded
      > > TIA
      > >
      > > Stu
      > >[/color]
      >
      >
      >[/color]

      Comment

      • Dilip Krishnan

        #4
        Re: Multi Threaded web Service

        Hello Stu,
        Every request is in its own thread/context, so making batch calls should
        not interfere with your application. It could be you're running out of memory
        or your aspnet wp is recycling because of the load or there is always this
        possiblity :).... Could it be a problem with the logic?

        HTH
        Regards,
        Dilip Krishnan
        MCAD, MCSD.net
        dkrishnan at geniant dot com
        Experience is the advantage. AI is the multiplier.

        [color=blue]
        > Hi,
        >
        > Its a calculator imagine it as a black box.
        > It grabs data then shoves everything into structures then process
        > and then writes back to the database
        > When Its called from a batch process to process thousands of clients
        > And then u call it from a web front end whilst its running you get
        > index out of bound errors
        >
        > When the web service is called
        > I assumed that the structures defined etc are for each call ?
        > ie protected in its own apartment and hence thats why I asked the
        > question
        > it works fine as a com+ component but want to move it away from there
        > without just wrapping a web service around the com+.ie pure web
        > service
        >
        > "Dilip Krishnan" wrote:
        >[color=green]
        >> Hello Stu,
        >> It should be... what are you trying to do and how is it failing
        >> (error
        >> message)
        >> HTH
        >> Regards,
        >> Dilip Krishnan
        >> MCAD, MCSD.net
        >> dkrishnan at geniant dot com
        >> http://www.geniant.com[color=darkred]
        >>> Hi,
        >>>
        >>> I have a web service that does database access and calculations
        >>> However it keeps falling over becuase its not multi threaded and
        >>> each
        >>> call to
        >>> it is not in its own space!!
        >>> I dont want to use com+ so is there any way of making it
        >>> Multi threaded
        >>> TIA
        >>> Stu
        >>>[/color][/color][/color]


        Comment

        • Stu

          #5
          Re: Multi Threaded web Service

          Hi Dilip
          The thing is it works as a com+ component

          All ive done is call the same com+ call eg calcMyData(cust omer)
          but exposed it as a web service and have made the whole thing a webservice

          Its definatley something to do with appartments or variables
          becuase if i kick the web service off on multiple threads from a test
          program I get the same error


          "Dilip Krishnan" wrote:
          [color=blue]
          > Hello Stu,
          > Every request is in its own thread/context, so making batch calls should
          > not interfere with your application. It could be you're running out of memory
          > or your aspnet wp is recycling because of the load or there is always this
          > possiblity :).... Could it be a problem with the logic?
          >
          > HTH
          > Regards,
          > Dilip Krishnan
          > MCAD, MCSD.net
          > dkrishnan at geniant dot com
          > http://www.geniant.com
          >[color=green]
          > > Hi,
          > >
          > > Its a calculator imagine it as a black box.
          > > It grabs data then shoves everything into structures then process
          > > and then writes back to the database
          > > When Its called from a batch process to process thousands of clients
          > > And then u call it from a web front end whilst its running you get
          > > index out of bound errors
          > >
          > > When the web service is called
          > > I assumed that the structures defined etc are for each call ?
          > > ie protected in its own apartment and hence thats why I asked the
          > > question
          > > it works fine as a com+ component but want to move it away from there
          > > without just wrapping a web service around the com+.ie pure web
          > > service
          > >
          > > "Dilip Krishnan" wrote:
          > >[color=darkred]
          > >> Hello Stu,
          > >> It should be... what are you trying to do and how is it failing
          > >> (error
          > >> message)
          > >> HTH
          > >> Regards,
          > >> Dilip Krishnan
          > >> MCAD, MCSD.net
          > >> dkrishnan at geniant dot com
          > >> http://www.geniant.com
          > >>> Hi,
          > >>>
          > >>> I have a web service that does database access and calculations
          > >>> However it keeps falling over becuase its not multi threaded and
          > >>> each
          > >>> call to
          > >>> it is not in its own space!!
          > >>> I dont want to use com+ so is there any way of making it
          > >>> Multi threaded
          > >>> TIA
          > >>> Stu
          > >>>[/color][/color]
          >
          >
          >[/color]

          Comment

          • Stu

            #6
            Re: Multi Threaded web Service

            Hi Dilip,

            Could be something to do with that the
            calculator is using a class which has shared properties on it ?


            "Stu" wrote:
            [color=blue]
            > Hi Dilip
            > The thing is it works as a com+ component
            >
            > All ive done is call the same com+ call eg calcMyData(cust omer)
            > but exposed it as a web service and have made the whole thing a webservice
            >
            > Its definatley something to do with appartments or variables
            > becuase if i kick the web service off on multiple threads from a test
            > program I get the same error
            >
            >
            > "Dilip Krishnan" wrote:
            >[color=green]
            > > Hello Stu,
            > > Every request is in its own thread/context, so making batch calls should
            > > not interfere with your application. It could be you're running out of memory
            > > or your aspnet wp is recycling because of the load or there is always this
            > > possiblity :).... Could it be a problem with the logic?
            > >
            > > HTH
            > > Regards,
            > > Dilip Krishnan
            > > MCAD, MCSD.net
            > > dkrishnan at geniant dot com
            > > http://www.geniant.com
            > >[color=darkred]
            > > > Hi,
            > > >
            > > > Its a calculator imagine it as a black box.
            > > > It grabs data then shoves everything into structures then process
            > > > and then writes back to the database
            > > > When Its called from a batch process to process thousands of clients
            > > > And then u call it from a web front end whilst its running you get
            > > > index out of bound errors
            > > >
            > > > When the web service is called
            > > > I assumed that the structures defined etc are for each call ?
            > > > ie protected in its own apartment and hence thats why I asked the
            > > > question
            > > > it works fine as a com+ component but want to move it away from there
            > > > without just wrapping a web service around the com+.ie pure web
            > > > service
            > > >
            > > > "Dilip Krishnan" wrote:
            > > >
            > > >> Hello Stu,
            > > >> It should be... what are you trying to do and how is it failing
            > > >> (error
            > > >> message)
            > > >> HTH
            > > >> Regards,
            > > >> Dilip Krishnan
            > > >> MCAD, MCSD.net
            > > >> dkrishnan at geniant dot com
            > > >> http://www.geniant.com
            > > >>> Hi,
            > > >>>
            > > >>> I have a web service that does database access and calculations
            > > >>> However it keeps falling over becuase its not multi threaded and
            > > >>> each
            > > >>> call to
            > > >>> it is not in its own space!!
            > > >>> I dont want to use com+ so is there any way of making it
            > > >>> Multi threaded
            > > >>> TIA
            > > >>> Stu
            > > >>>[/color]
            > >
            > >
            > >[/color][/color]

            Comment

            • Dilip Krishnan

              #7
              Re: Multi Threaded web Service

              Hello Stu,
              You're absolutely right. there is a problem in the com+ component and
              the way its being used by ASP.net.

              HTH
              Regards,
              Dilip Krishnan
              MCAD, MCSD.net
              dkrishnan at geniant dot com
              Experience is the advantage. AI is the multiplier.

              [color=blue]
              > Hi Dilip
              > The thing is it works as a com+ component
              > All ive done is call the same com+ call eg calcMyData(cust omer) but
              > exposed it as a web service and have made the whole thing a webservice
              >
              > Its definatley something to do with appartments or variables
              > becuase if i kick the web service off on multiple threads from a test
              > program I get the same error
              > "Dilip Krishnan" wrote:
              >[color=green]
              >> Hello Stu,
              >> Every request is in its own thread/context, so making batch calls
              >> should
              >> not interfere with your application. It could be you're running out
              >> of memory
              >> or your aspnet wp is recycling because of the load or there is always
              >> this
              >> possiblity :).... Could it be a problem with the logic?
              >> HTH
              >> Regards,
              >> Dilip Krishnan
              >> MCAD, MCSD.net
              >> dkrishnan at geniant dot com
              >> http://www.geniant.com[color=darkred]
              >>> Hi,
              >>>
              >>> Its a calculator imagine it as a black box.
              >>> It grabs data then shoves everything into structures then process
              >>> and then writes back to the database
              >>> When Its called from a batch process to process thousands of clients
              >>> And then u call it from a web front end whilst its running you get
              >>> index out of bound errors
              >>> When the web service is called
              >>> I assumed that the structures defined etc are for each call ?
              >>> ie protected in its own apartment and hence thats why I asked the
              >>> question
              >>> it works fine as a com+ component but want to move it away from
              >>> there
              >>> without just wrapping a web service around the com+.ie pure web
              >>> service
              >>> "Dilip Krishnan" wrote:
              >>>
              >>>> Hello Stu,
              >>>> It should be... what are you trying to do and how is it failing
              >>>> (error
              >>>> message)
              >>>> HTH
              >>>> Regards,
              >>>> Dilip Krishnan
              >>>> MCAD, MCSD.net
              >>>> dkrishnan at geniant dot com
              >>>> http://www.geniant.com
              >>>>> Hi,
              >>>>>
              >>>>> I have a web service that does database access and calculations
              >>>>> However it keeps falling over becuase its not multi threaded and
              >>>>> each
              >>>>> call to
              >>>>> it is not in its own space!!
              >>>>> I dont want to use com+ so is there any way of making it
              >>>>> Multi threaded
              >>>>> TIA
              >>>>> Stu[/color][/color][/color]



              Comment

              • Stu

                #8
                Re: Multi Threaded web Service

                Hi Dilip
                So if I remove the static class it will fix the problem
                Its not a com+ component any more its a pure web service


                "Dilip Krishnan" wrote:
                [color=blue]
                > Hello Stu,
                > You're absolutely right. there is a problem in the com+ component and
                > the way its being used by ASP.net.
                >
                > HTH
                > Regards,
                > Dilip Krishnan
                > MCAD, MCSD.net
                > dkrishnan at geniant dot com
                > http://www.geniant.com
                >[color=green]
                > > Hi Dilip
                > > The thing is it works as a com+ component
                > > All ive done is call the same com+ call eg calcMyData(cust omer) but
                > > exposed it as a web service and have made the whole thing a webservice
                > >
                > > Its definatley something to do with appartments or variables
                > > becuase if i kick the web service off on multiple threads from a test
                > > program I get the same error
                > > "Dilip Krishnan" wrote:
                > >[color=darkred]
                > >> Hello Stu,
                > >> Every request is in its own thread/context, so making batch calls
                > >> should
                > >> not interfere with your application. It could be you're running out
                > >> of memory
                > >> or your aspnet wp is recycling because of the load or there is always
                > >> this
                > >> possiblity :).... Could it be a problem with the logic?
                > >> HTH
                > >> Regards,
                > >> Dilip Krishnan
                > >> MCAD, MCSD.net
                > >> dkrishnan at geniant dot com
                > >> http://www.geniant.com
                > >>> Hi,
                > >>>
                > >>> Its a calculator imagine it as a black box.
                > >>> It grabs data then shoves everything into structures then process
                > >>> and then writes back to the database
                > >>> When Its called from a batch process to process thousands of clients
                > >>> And then u call it from a web front end whilst its running you get
                > >>> index out of bound errors
                > >>> When the web service is called
                > >>> I assumed that the structures defined etc are for each call ?
                > >>> ie protected in its own apartment and hence thats why I asked the
                > >>> question
                > >>> it works fine as a com+ component but want to move it away from
                > >>> there
                > >>> without just wrapping a web service around the com+.ie pure web
                > >>> service
                > >>> "Dilip Krishnan" wrote:
                > >>>
                > >>>> Hello Stu,
                > >>>> It should be... what are you trying to do and how is it failing
                > >>>> (error
                > >>>> message)
                > >>>> HTH
                > >>>> Regards,
                > >>>> Dilip Krishnan
                > >>>> MCAD, MCSD.net
                > >>>> dkrishnan at geniant dot com
                > >>>> http://www.geniant.com
                > >>>>> Hi,
                > >>>>>
                > >>>>> I have a web service that does database access and calculations
                > >>>>> However it keeps falling over becuase its not multi threaded and
                > >>>>> each
                > >>>>> call to
                > >>>>> it is not in its own space!!
                > >>>>> I dont want to use com+ so is there any way of making it
                > >>>>> Multi threaded
                > >>>>> TIA
                > >>>>> Stu[/color][/color]
                >
                >
                >
                >[/color]

                Comment

                • Dilip Krishnan

                  #9
                  Re: Multi Threaded web Service

                  Hello Stu,
                  Oh sure that would certainly cause the problem! Any static class needs
                  to be thread safe

                  HTH
                  Regards,
                  Dilip Krishnan
                  MCAD, MCSD.net
                  dkrishnan at geniant dot com
                  Experience is the advantage. AI is the multiplier.

                  [color=blue]
                  > Hi Dilip
                  > So if I remove the static class it will fix the problem
                  > Its not a com+ component any more its a pure web service
                  > "Dilip Krishnan" wrote:
                  >[color=green]
                  >> Hello Stu,
                  >> You're absolutely right. there is a problem in the com+ component and
                  >> the way its being used by ASP.net.
                  >> HTH
                  >> Regards,
                  >> Dilip Krishnan
                  >> MCAD, MCSD.net
                  >> dkrishnan at geniant dot com
                  >> http://www.geniant.com[color=darkred]
                  >>> Hi Dilip
                  >>> The thing is it works as a com+ component
                  >>> All ive done is call the same com+ call eg calcMyData(cust omer) but
                  >>> exposed it as a web service and have made the whole thing a
                  >>> webservice
                  >>> Its definatley something to do with appartments or variables
                  >>> becuase if i kick the web service off on multiple threads from a
                  >>> test
                  >>> program I get the same error
                  >>> "Dilip Krishnan" wrote:
                  >>>> Hello Stu,
                  >>>> Every request is in its own thread/context, so making batch calls
                  >>>> should
                  >>>> not interfere with your application. It could be you're running out
                  >>>> of memory
                  >>>> or your aspnet wp is recycling because of the load or there is
                  >>>> always
                  >>>> this
                  >>>> possiblity :).... Could it be a problem with the logic?
                  >>>> HTH
                  >>>> Regards,
                  >>>> Dilip Krishnan
                  >>>> MCAD, MCSD.net
                  >>>> dkrishnan at geniant dot com
                  >>>> http://www.geniant.com
                  >>>>> Hi,
                  >>>>>
                  >>>>> Its a calculator imagine it as a black box.
                  >>>>> It grabs data then shoves everything into structures then process
                  >>>>> and then writes back to the database
                  >>>>> When Its called from a batch process to process thousands of
                  >>>>> clients
                  >>>>> And then u call it from a web front end whilst its running you get
                  >>>>> index out of bound errors
                  >>>>> When the web service is called
                  >>>>> I assumed that the structures defined etc are for each call ?
                  >>>>> ie protected in its own apartment and hence thats why I asked the
                  >>>>> question
                  >>>>> it works fine as a com+ component but want to move it away from
                  >>>>> there
                  >>>>> without just wrapping a web service around the com+.ie pure web
                  >>>>> service
                  >>>>> "Dilip Krishnan" wrote:
                  >>>>>> Hello Stu,
                  >>>>>> It should be... what are you trying to do and how is it failing
                  >>>>>> (error
                  >>>>>> message)
                  >>>>>> HTH
                  >>>>>> Regards,
                  >>>>>> Dilip Krishnan
                  >>>>>> MCAD, MCSD.net
                  >>>>>> dkrishnan at geniant dot com
                  >>>>>> http://www.geniant.com
                  >>>>>>> Hi,
                  >>>>>>>
                  >>>>>>> I have a web service that does database access and calculations
                  >>>>>>> However it keeps falling over becuase its not multi threaded and
                  >>>>>>> each
                  >>>>>>> call to
                  >>>>>>> it is not in its own space!!
                  >>>>>>> I dont want to use com+ so is there any way of making it
                  >>>>>>> Multi threaded
                  >>>>>>> TIA
                  >>>>>>> Stu[/color][/color][/color]



                  Comment

                  • Stu

                    #10
                    Re: Multi Threaded web Service

                    Hi,

                    Ive removed the static problem now took me ages.
                    So heres a summary

                    i have a dot net webservice in vb dot net say
                    objcalc.calcula te(customerId)
                    I know that web services are multi threaded but how do I ensure
                    my webservice can handle mutliple synchronous requests the web service
                    doesnt not need to be asynchronous.

                    Do I need to synchlock my parameter passed into the web service ?
                    What about thread pooling etc ?

                    Most samples seem to show how you kick off which I understand
                    But not in the webservice itself so Any code for this would be appreciated



                    "Dilip Krishnan" wrote:
                    [color=blue]
                    > Hello Stu,
                    > Oh sure that would certainly cause the problem! Any static class needs
                    > to be thread safe
                    >
                    > HTH
                    > Regards,
                    > Dilip Krishnan
                    > MCAD, MCSD.net
                    > dkrishnan at geniant dot com
                    > http://www.geniant.com
                    >[color=green]
                    > > Hi Dilip
                    > > So if I remove the static class it will fix the problem
                    > > Its not a com+ component any more its a pure web service
                    > > "Dilip Krishnan" wrote:
                    > >[color=darkred]
                    > >> Hello Stu,
                    > >> You're absolutely right. there is a problem in the com+ component and
                    > >> the way its being used by ASP.net.
                    > >> HTH
                    > >> Regards,
                    > >> Dilip Krishnan
                    > >> MCAD, MCSD.net
                    > >> dkrishnan at geniant dot com
                    > >> http://www.geniant.com
                    > >>> Hi Dilip
                    > >>> The thing is it works as a com+ component
                    > >>> All ive done is call the same com+ call eg calcMyData(cust omer) but
                    > >>> exposed it as a web service and have made the whole thing a
                    > >>> webservice
                    > >>> Its definatley something to do with appartments or variables
                    > >>> becuase if i kick the web service off on multiple threads from a
                    > >>> test
                    > >>> program I get the same error
                    > >>> "Dilip Krishnan" wrote:
                    > >>>> Hello Stu,
                    > >>>> Every request is in its own thread/context, so making batch calls
                    > >>>> should
                    > >>>> not interfere with your application. It could be you're running out
                    > >>>> of memory
                    > >>>> or your aspnet wp is recycling because of the load or there is
                    > >>>> always
                    > >>>> this
                    > >>>> possiblity :).... Could it be a problem with the logic?
                    > >>>> HTH
                    > >>>> Regards,
                    > >>>> Dilip Krishnan
                    > >>>> MCAD, MCSD.net
                    > >>>> dkrishnan at geniant dot com
                    > >>>> http://www.geniant.com
                    > >>>>> Hi,
                    > >>>>>
                    > >>>>> Its a calculator imagine it as a black box.
                    > >>>>> It grabs data then shoves everything into structures then process
                    > >>>>> and then writes back to the database
                    > >>>>> When Its called from a batch process to process thousands of
                    > >>>>> clients
                    > >>>>> And then u call it from a web front end whilst its running you get
                    > >>>>> index out of bound errors
                    > >>>>> When the web service is called
                    > >>>>> I assumed that the structures defined etc are for each call ?
                    > >>>>> ie protected in its own apartment and hence thats why I asked the
                    > >>>>> question
                    > >>>>> it works fine as a com+ component but want to move it away from
                    > >>>>> there
                    > >>>>> without just wrapping a web service around the com+.ie pure web
                    > >>>>> service
                    > >>>>> "Dilip Krishnan" wrote:
                    > >>>>>> Hello Stu,
                    > >>>>>> It should be... what are you trying to do and how is it failing
                    > >>>>>> (error
                    > >>>>>> message)
                    > >>>>>> HTH
                    > >>>>>> Regards,
                    > >>>>>> Dilip Krishnan
                    > >>>>>> MCAD, MCSD.net
                    > >>>>>> dkrishnan at geniant dot com
                    > >>>>>> http://www.geniant.com
                    > >>>>>>> Hi,
                    > >>>>>>>
                    > >>>>>>> I have a web service that does database access and calculations
                    > >>>>>>> However it keeps falling over becuase its not multi threaded and
                    > >>>>>>> each
                    > >>>>>>> call to
                    > >>>>>>> it is not in its own space!!
                    > >>>>>>> I dont want to use com+ so is there any way of making it
                    > >>>>>>> Multi threaded
                    > >>>>>>> TIA
                    > >>>>>>> Stu[/color][/color]
                    >
                    >
                    >
                    >[/color]

                    Comment

                    Working...