Session Object Details
Hi Das,
There is no connection between the ”blessing” of ”sql variables” and the session in which they are defined. In the example that I used at Euromnis clinics I define the row vars for each data object at the first instantiation of the object and use that as a template to copy every time I need an instance of the row var. A copy demands about 30% of the processing power compared to $definebysqlclass which can have a heavy impact on app server-based systems with hundreds of simultaneous users. In the startup task of the system I send out a command like Do $objects.$sendall($ref().$init(),kFalse) to force a first instantiation of all the objects in the system with a $init method. This pre-loads all the row variable templates in the system.
Session pools are vital tools to optimise the proper use of the DB servers. In the context of Postgres every session is directly connected to an postgres connection instance on the server – which is in its turn directly connected to a main processor core as I have understood it. If one have a lot of sessions then of course these are sharing access to the different cores. The problem here is that each one of these connections demand memory which is blocked for other purposes – especially if you have aggressively assigned high values for memory management to keep the performance up.
In my own programming I aggressively use session pools (some aspects covered earlier) but I do not bind these session pools to tasks – not fat client tasks nor remote tasks. In the case of remote task by this approach each connected user consumes one session that often have to handle a large number of different operations. And it might create problems when using more advanced approaches of workers.
I tend to use session pools in combination with sessions that are limited in scope to local and instance scopes – local scope for standard db access and instance scope for sql worker approaches. I also use routines for automatically scaling up and down the number of available sessions in the pools to keep an eye on memory use at the server. This results in minimised use of sessions for a relatively large number of accesses by end-users and processes – maximising the memory and processor use at the server for each user operation.
In my test systems with this approach about 50 transactions a second demands 2-3 active db sessions. The demand can be higher if the sql workers demand more time for their operation but the resource use in the db server is kept quite low.
For more extensive operations including several tables etc. which will demand transaction management the use of process objects in combination with the passing of session pool references should be the best approach in this case of scenario.
Take care, all the best…
Stene
______
> 7 mars 2018 kl. 02:01 skrev Das Goravani <das@goravani.com>:
>
>
> Does the session object you “bless” your rows and lists with have to be the same one you do other session object things with?
>
> Said another way, can you bless your rows with one, and be using another one in your code that works with those lists?
>
> Another way: What’s wrong with using a Task Variable session object throughout?
>
>
> How this happened: I got wind that a universal task variable session object was somehow second class. I don’t remember there being any specifics, but I got that it was frowned on. So I labored to be hip and I made a session pool and in my main object that holds my windows code I labored and made an Instance Variable session object and statement object. Now those two are used in my code, while the universal one isn’t used much except during logon where I create it. Now I’m thinking of ‘blessing’ all my lists and rows in one method during startup, and using the universal one to bless them, but they might be used with other session objects such as in my object where most of the code is. I could easily use search and replace and use only the universal one. The only things I see the session object being used for is things like Commit and Rollback… in constant use…it seems you rarely invoke it’s name. Does it matter if commit and rollback are done with a different session object than the one you blessed your rows with?
>
> If you’re wondering about the universal up front blessing of rows verse how do I get those into instance variables, the answer is through Calculate iRow as tRow. Simple calculate as”” statement. It’s easier than typing the two lines of code all the time the first being define from sql class to define the row the second being assigning the session object to the row. I will have that code only once with my new idea, and otherwise just copy the universal ones made up front into the local ones used on the ground.
>
> If I can bless with one and use any other I’ll be a happy camper. I don’t really “get” session objects yet, therein lay the problem.
Sten-Erik Björling
Enviro Data
Kyrkogatan 5A 2 tr
SE-972 32 Luleå
Sweden
E-Mail: s-e.bjorling@enviro.se
Mobile: +46-70-655 11 72
Wire: @stenerikbjorling
Skype: stenerikbjorling
iChat: stene@mac.com
FaceTime: stene@mac.com
Hotmail / Messenger: stenerikbjorling@hotmail.com
GMail: stenerikbjorling@gmail.com
______
This email and any files transmitted with it are confidential, may be legally privileged and are intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient, please note that any use, distribution, or reproduction of the contents of this email is strictly prohibited and may be unlawful. If you are not the intended recipient, please notify the sender by return email and destroy all copies of the original message including any attachments thereto. Thank you.
Please note that we take reasonable precautions to prevent the transmission of viruses; however, we cannot guarantee that this email or its attachments are free from viruses. We only send and receive emails on the basis that we are not be liable for any loss or damage resulting from the opening of this message and/or attachments.
_____________________________________________________________
Manage your list subscriptions at lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com