Interesting Idea. You should be able to make this work, assuming the
following:

1- You are on 64 Bit with good memory
2- You've tuned your JVM (the stock CF settings won't work for you)

Another idea would be to wrap up the specifics of the domain into a CFC
called CurrentDomainLoader.  This would be a CFC with only one method that
returns the current domain for the current request.

You'd then be able to call this CFC whenever you need the domain to service
a request. That way, everything pipes through a single CFC base, and your
CurrentDomainLoader handles loading the specificity for the current request.


DW




On Fri, Jul 23, 2010 at 2:27 PM, jeff <[email protected]> wrote:

> As my application scales, my ram keeps getting eaten up.  And based on
> the traffic coming to the server, I wonder If my architecture needs
> some adjustment to function better.
>
> Basically this is how things work:
> There are lots of domains all configured to use this same model-glue
> application.  The magic happens in the init() function in the
> controller where I figure out which domain is being loaded, and then I
> load ALL the cfcs into the variables scope like this:
>
> <cffunction name="Init" access="Public" returnType="Controller"
> output="false" hint="I build a new SampleController">
>  <cfargument name="ModelGlue" required="true"
> type="ModelGlue.ModelGlue" />
>  <cfargument name="InstanceName" required="true" type="string" />
>  <cfset super.Init(arguments.ModelGlue) />
> <!--- Turns out we don't need this after all.  We'll keep it here just
> in case we do down the road.
>        <!--- get the model glue coldspring global config bean --->
>        <cfset var mgConfig =
> getModelGlue().getBean("modelGlueConfiguration") />
>        <!--- grab the variables we'll need to reload the site. (this is
> used
> when resetting themes!) --->
>        <cfset variables.reloadKey = mgConfig.getReloadKey() />
>        <cfset variables.getReloadPassword = mgConfig.getReloadPassword() />
>  --->
>
>        <!--- Get all of our app settings --->
>        <cfset var appSettings = getModelGlue().getBean("appSettings") />
>
>        <!--- load config settings here --->
>        <cfset variables.dsn = appSettings.getConfigSetting("dsn") />
>
>        <!--- Load up the site configuration settings here --->
>        <cfset variables.siteSettingsCFC = createObject("component",
> "model.siteSettings").init(variables.dsn,cleanURL(CGI.SERVER_NAME)) />
>        <cfset variables.siteID = variables.siteSettingsCFC.getSiteID() />
>
>        <!--- database interaction CFCS --->
>        <cfset variables.exampleCFC = createObject("component",
> "model.example").init(variables.dsn,variables.siteID) />
>        <cfset variables.exampleCFC = createObject("component",
> "model.example").init(variables.dsn,variables.siteID) />
>        <cfset variables.exampleCFC = createObject("component",
> "model.example").init(variables.dsn,variables.siteID) />
>        <cfset variables.exampleCFC = createObject("component",
> "model.example").init(variables.dsn,variables.siteID) />
>        <cfset variables.exampleCFC = createObject("component",
> "model.example").init(variables.dsn,variables.siteID) />
>        <cfset variables.exampleCFC = createObject("component",
> "model.example").init(variables.dsn,variables.siteID) />
>        <cfset variables.exampleCFC = createObject("component",
> "model.example").init(variables.dsn,variables.siteID) />
>        <cfset variables.exampleCFC = createObject("component",
> "model.example").init(variables.dsn,variables.siteID) />
>        <cfset variables.exampleCFC = createObject("component",
> "model.example").init(variables.dsn,variables.siteID) />
>        <cfset variables.exampleCFC = createObject("component",
> "model.example").init(variables.dsn,variables.siteID) />
>        <cfset variables.exampleCFC = createObject("component",
> "model.example").init(variables.dsn,variables.siteID) />
>        <cfset variables.exampleCFC = createObject("component",
> "model.example").init(variables.dsn,variables.siteID) />
>        <cfset variables.exampleCFC = createObject("component",
> "model.example").init(variables.dsn,variables.siteID) />
>        <cfset variables.exampleCFC = createObject("component",
> "model.example").init(variables.dsn,variables.siteID) />
>
>
>  <cfreturn this />
> </cffunction>
>
> -------------------------
>
> After this occurs we basically have an isolated model-glue application
> loaded for each domain, which makes it easy to keep all the data
> separate.  But I am now wondering if this is eating up all the memory
> and there is a better way to design my application; perhaps creating
> the objects on demand instead of instantiating them into memory in the
> init().
>
> --
> Model-Glue Sites:
> Home Page: http://www.model-glue.com
> Documentation: http://docs.model-glue.com
> Bug Tracker: http://bugs.model-glue.com
> Blog: http://www.model-glue.com/blog
>
> You received this message because you are subscribed to the Google
> Groups "model-glue" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<model-glue%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/model-glue?hl=en




-- 
William Osler - "We are here to add what we can to life, not to get what we
can from life."

-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

Reply via email to