Application.cfm - Should I use queries or set session variables?

Hi,
I have an application that has many users for many different
companies logged in at the same time using the system. I use the
application.cfm to call and set a bunch of variables that make the
system work, such as preferences and things. Would it be better to
use 5 or 6 queries all pulling one record, or call the queries only
once at the start of the session and set 30 to 50 session variables
based on the query results? Which method would bog the system down
less? It seems that session variables use quite a bit of memory.
I'm just trying to get the "simple answer" for this, if that's even
possible.
Please let me know your thoughts and experience on this.
Thanks much,
Jeff W!

In order to give you a simple "do it this way" answer, more
information is needed.
How long does it take to run those 5-6 queries on each
request? How many users are logged in at peak times? How much data
would you be storing in the session for each user? How much RAM do
you have on your server?
On one application, we've decided to go the session variable
route. The size for each users' session maxes out at 2.5 KB. We
have 512 MB dedicated to CF, but can easily scale up on the
hardware we have to 1.5 GB or more. At 512 MB, 2.5 KB per user
session, we can handle a little over 200,000 concurrent users
(assuming all CF memory could be utilized for session variables,
which isn't true). There are only 6,000 users total in our system,
so we have quite a bit of headroom.
Are you on CF8? If so, open up the server monitor, start
monitoring, profiling, and memory tracking, and log in with a
couple users (with your code setup to store all that info in the
session). See how much storage each session takes. Then look at
your server. How much RAM do you have? what do you currently have
allocated to ColdFusion? What's your peak concurrent user level? Do
you have headroom? Also, see if the benefits of storing it in the
session are even worth it (how long do those 5-6 queries add to
each requst?)

Similar Messages

  • Set session variables inside a page

    Inside the page "form.cfm" I have this code:
    <form name="report" action="pagestatistic.cfm"
    method="post">
    <INPUT name=ONE size=15 >
    <INPUT name=TWO size=15 >
    <input type="submit" value="Go ON">
    </form>
    I would like to set session variable: ONE and TWO, inside the
    page: pagestatistic.cfm
    IN that way when I will refresh the page "pagestatistic.cfm"
    I will watch have the same results.
    I added this code at the top of "pagestatistic.cfm" but it
    doesn't work.
    <CFSET session.ONE = #ONE#>
    <CFSET session.TWO = #TWO#>
    Could you tell me what goes wrong?
    Thanks
    CFWork

    quote:
    Originally posted by:
    liquid One
    When you say refresh the page, do you mean submit the form by
    clicking on the submit button? Or are you filling out the input
    boxes and hitting refresh?
    I mean I clicked a link that links the same page:
    pagestatistic.cfm
    Then I would like to add to this link 2 get variables
    pagestatistic.cfm?ColorPage=Green&Order=2 to change the
    background color and the order of the results of the page. That it
    is impossible because when i refresh the page it is doesn't work.
    What do you suggest me to do?
    Thanks,
    CfWork

  • Use button to set a variable

    hi, can someone help me.
    I would like to use a couple of buttons that I made to set a variable. I'd like to use the instance name of the button(s) as the value stored as the variable. how can i code this?
    thanks.

    You can use the currentTarget of the event to target the button and acquire its name...
    var btnName:String;
    btn.addEventListener(MouseEvent.CLICK, storeName);
    function storeName(evt:MouseEvent):void {
         btnName = evt.currentTarget.name;
         trace(btnName); // will trace "btn"

  • Set Session Variable

    Hello,
    Anyone know how to set a session variable from data entered within a messageTextInput field from a uix page within a JHeadstart application?
    I tried to trigger an event to write the session but was unsuccessful.
    Any ideas?
    -Jeff

    Jeff,
    We do not support UIX events, because they are part of the UIX Controller. We use the Oracle9iAS MVC Framework (or Struts in next release) as the Controller.
    So, if you want to put a value of a messageTextInput on the session, you need to write a custom process that does this. Note that the MVC Framework provides an abstraction called the InfoTable around the Session object.
    In chapter 2 of the JHeadstart User Guide, section "Writing a Custom Process" you can find more information on reading and writing information from/to the InfoTable.
    Steven Davelaar,
    JHeadstart Team.

  • 'In Between' Date Prompt to set Session Variables???

    Hi
    Im very new to OBIEE and was hoping someone could help me. I have a date prompt using the 'in between' operator based on a date column.
    I am trying to set up a table in the Physical layer of the RPD using a stored proc (EXEC sp_name). The stored proc takes 2 input paramaters - a start data and an end date. These dates i would like to come from the in between prompt. I have set up the physical table structure to receive the results of the request.
    I looked at setting a session variable but it is asking me to insert sql to set the value and i dont want to hit the database outside of the stored proc. Also, even if i have session variables i cant see how to set them to the values in the prompt when using the 'In Between' operator.
    Im really very confused and i have been searching the net and the documentation for any clue.
    Any help would be appreciated
    Thanks

    In between operator doesn't support presentation variable..
    so break this into is into two prompts...and use equal to operator, then you can use them as request variables which will in turn override your session variables.
    in the report use operator between and use these variables in the filter..

  • Can I set session variables from inside my Javascript?

    hi all,
    i want to set a couple of session variable while i am inside my javascript.
    can I do that?
    m_asu

    No. JavaScript runs on the client and the session is on the server. You can use JavaScript to set parameters that get passed back in the request and can then be put in the session.

  • How to re-set session variables in OCI when a TAF callback  is invoked ?

    Can you show me an example of how to re-set NLS_DATE_FORMAT when the Failover ends ( that is, in OCI_FO_END )? All I see is the template code provided by Oracle to handle TAF event.
    How to register TAF callback function

    You can re-set the variable just like you set it at the beginning of the connection in the switch branch you mentioned.
    Doesn't it work?

  • Can Java be used to capture the session variables

    We want to access the session variables using Java or JAvascript and change them. The changed session variable value must get reflected across the session.
    Please point us to any documention or solution which we use.

    Hi,
    I do not know about Java, but I have read Venkat's blog and he has written about updating session variables:
    http://oraclebizint.wordpress.com/2008/02/25/oracle-bi-ee-101332-updating-session-variables-from-dashboards-using-presentation-variables/
    http://oraclebizint.wordpress.com/2008/02/28/oracle-bi-ee-101332-updating-session-variables-through-go-url/
    Hop this helps.
    Good Luck,
    Daan Bakboord

  • Setting session variables in application context using OpenJPA

    Hi!
    I am using openjpa 1.2 with EJB 3.0. I am connecting to Oracle 11g database and need to use the oracle virtual private database for security and data segregation. For this purpose, I need to set some custom variables at the session level of the application context such as the application user name. Since, I am using container injected EntityManager using @PersistenceContext, I am finding it hard to do so.
    Can anyone please help me out
    Thanks in advance
    Abhi

    You will probably want to ask your question on an OpenJPA forum to see if they even can support VPD (if not, see EclipseLink http://wiki.eclipse.org/Introduction_to_EclipseLink_Sessions_(ELUG)#Isolated_Client_Sessions_and_Oracle_Virtual_Private_Database_.28VPD.29 )
    You might also want to try injecting the factory instead and use that to get the EntityManager instead of injecting the em directly. ie
    @PersistenceUnit(unitName="my-pu")
    private EntityManagerFactory emf;
    Best Regards,
    Chris

  • Which Application Server should I Use

    Hi All,
    I am learning the EJBs for the first time. I tried to search for tutorials and found a few tutorials in SUN website. For some they asked me to install weblogic server. Then in another link they are showing sun application server.
    Please advise which application server is better or more widely used. I am learning EJB's to improve my job prospects.
    Thanks

    You can use the Sun application server. Please checkout the following links:
    http://glassfish.dev.java.net
    https://glassfish.dev.java.net/javaee5/ejb/
    and
    http://java.sun.com/javaee/5/docs/tutorial/doc/

  • Setting session variable names based on variables in a loop

    I am trying to set up a loop that sets up a list of variables based upon a list, by looping over the list and setting the session.NAME:
    <CFLOOP list="#fieldnames#" index="fieldname">
    <cfset session.#fieldname# = "1">
    </CFLOOP>
    It does not seem to like session.A_CF_VARIABLE . so session.#fieldname# does not work, I get an error
    A CFML variable name cannot end with a "." character.
    The variable session. ends with a "." character. You must supply an additional structure key or delete the "." character.
    Do I have to wrap it a different way?
    Thanks
    Mark

    ahh. great. that fixed the loop problem. My second problem now appears that I am not picking up the correct data.
    My test data has a form post with field names EMAIL and GENDER, and then I was trying to write session.email = VALUE_OF_FORM_FOR_EMAIL .. session.gender = VALUE_OF_FORM_FOR_GENDER, but what I am actually doing is writing the values EMAIL and GENDER into the session. so session.email has the value EMAIL.. and not what I typed into the form.
    I guess it's because the fieldname in the index is also used as the name in the form and it's confusing it, so it goes for the wrong one, not the value from the form.
    the alternative would be to append something to the name of each field in the form.. so email is F_email and F_gender... although i tried this and using <CFSET session[fieldname] = "F_#fieldname"> but that threw an error, maybe just a formatting issue. I'd prefer to try and make it work without appending anything to the form names
    Here's some test code that has the form fields hard coded -->
    <CFSET fieldnames="email,gender">
    <CFSET email = "[email protected]">
    <CFSET gender = "M">
    <CFLOOP list="#fieldnames#" index="fieldname">
    <cfset session[fieldname] = '#fieldname#'>
    </CFLOOP>
    Thanks once again for the help
    Mark

  • Set Session Variables

    Is it possible to set 'OS_USER','TERMINAL' or 'HOST' in 'USERENV' in C#?
    This assignment is possible to do as in the example code in java.
    Link: https://community.oracle.com/thread/258126

    See http://msdn.microsoft.com/en-us/library/96xafkes(v=vs.110).aspx for details
    Environment.SetEnvironmentVariable("MyVariable", "MyValue", EnvironmentVariableTarget.User);

  • OT: Application.cfm but for PHP?

    All,
    I'm doing some maintenance on a PHP site for a friend. I've
    never messed
    with PHP before. what i'm looking for is an
    application.cfm-style thing
    where i can set request variables in one place and have all
    pages get those
    vars. Anyone here who knows PHP know if this can be done? or
    do I have to
    just make a globals.php and include it in all pages?
    thanks a lot.
    Marc

    So, I'm wondering if there is any way to allow a certain page to be exempt from login. Or, find out if anyone has any other ideas that may work.
    You're pretty much describing the solution in narrative form there.
    Put a conditional in your Application.cfm that bypasses the login if the requested URL (or template, depending on how your site is designed) is one of these "special" ones.
    Or if your template is in a subdirectory (which, by the sounds, it ought to be), then put a different Application.cfm in that subdir.  One that restricts access based on IP address or something rather than login authentication (because you'd not want just anyone accessing that URL, obviously).
    Adam

  • Setting Username/Password in Application.cfm

    I'm just moving my DB from Access over to MSSql, and I'm
    having difficulty figuring out how to set a global
    username/password in Application.cfm.
    I am able to set the username and password within the
    individual queries (using username= and password=) but I'd like to
    set the username and password within application.cfm so I do not
    have to go and change each and every cfquery statement throughout
    my site.
    So, essentially, I'm looking to insert code int he
    Application.cfm which logs into the MSSQL server, so whenever a
    cfquery is executed, the db is already logged into.
    Thanks!
    Andrew

    You can set application variables for your user name and
    password within application.cfm, then use those variables in your
    cfquery and cfstoredproc tags. That will allow you to change the
    value in one place instead of having to do it everywhere. As for
    staying logged on to the server, you may want to consider checking
    the Maintain Connections option in your advanced settings for your
    particular data source in ColdFusion Administrator.
    Phil

  • Should I use the fine-grained auditing?

    I need to record the changes (of data) made to serveral tables by users. For example, I have to check the before and after images of the changes and what kind of transactions they do to cause the changes. Sould I program the logging procedure in the application or should I use the fine-grained auditing function of oracle to do it. I am not sure what this built-in function can do for me. Can anyone give me some advice on this? Thks.
    A beginner

    Why Fine-Grained Auditing?
    You may want to check standard auditing if it is suitable for you
    http://download.oracle.com/docs/cd/B19306_01/network.102/b14266/cfgaudit.htm#BABCFIHB
    I don't think you can get pre and post update values of the affected data with Auditing.
    FGA is useful when you want to audit just a "subset" of the data in the table.
    (for instance, audit everyone that wants to get all records from EMP table where SALARY > 100000)
    Message was edited by:
    tekicora

Maybe you are looking for