3 Replies Latest reply on May 10, 2006 5:08 PM by madtux2

    Object In Application Scope or new Object every request?

    madtux2
      Hi,

      I was wondering which is more efficient? I have an array of url's, maybe as many as 50,000 urls. This array will be frequently updated based on user activity. My question is would it be more efficient to put the array into application scope, or create a new array for each request and user and how big of an object is too big to store in application scope?

      Thanks...
        • 1. Re: Object In Application Scope or new Object every request?
          Level 7
          madtux2 wrote:
          > Hi,
          >
          > I was wondering which is more efficient? I have an array of url's, maybe as
          > many as 50,000 urls. This array will be frequently updated based on user
          > activity. My question is would it be more efficient to put the array into
          > application scope, or create a new array for each request and user and how big
          > of an object is too big to store in application scope?
          >
          > Thanks...
          >

          Are these URLs stored in a database? If so, why not just cache the
          query and put the query object in the Application scope? "How big is
          too big" is completely dependent upon the amount of RAM you have on your
          server.

          --
          Matt Woodward
          mpwoodward@gmail.com
          Adobe Community Expert - ColdFusion
          • 2. Re: Object In Application Scope or new Object every request?
            furious70 Level 1
            I would add, consider what you are using the data for. Is it for the particular page the user has loaded? Will it be useful for the entire time the user is on your site? Is it something that one instance of is sufficient to serve all your users simultaneously? These questions can also guide in what scope the data should be placed.
            • 3. Re: Object In Application Scope or new Object every request?
              madtux2 Level 1
              Hi,

              The data or URL's will be served to many users continuously. In response to users actions URL's will be removed or added. Those actions have to be in real time so I think that may rule out query caching. Basically, the entire set of URL's have to be available for any number of users. I was thinking that storing the array in the application scope and modifiying /add and delete url's when necessary might be a better alternative than creating a thousand arrays of 50,000 urls for a thousand requests for example. Not sure which is more efficient ? Creating a one array for each request or storing an array with that many rows in the application scope and serving all requests with the single data object? In general what is an acceptable size of an object in application scope? I do use some single threaded service cfc's in application scope, but am not sure if there are any recommended best practices when it comes to data objects. Thanks for the replies...