Jump to content

What is Session in UniGui?


Recommended Posts

I was testing AllowTerminate example and added 1 timer on the form to count the time, spent from the start. And for my surprise - if checked AllowTerminate as true or not - reaction was the same - Application was going to work and didn't terminated util manual terminate.

 

Then I made conclusion - when Application do something - even if we move form, enabling timer, pressing buttons - any activity - then, it seems to me its communicating to the Server and session continues!!! Then if I understand correct - SessionTimeout begins from the moment of last Activity.

 

Activity from client? Sessions - continues. Application continues to work.

 

No Activity? SessionTimeout starts and Application will be terminated.

 

I post it here because I didn't know that and maybe some new developers who didn't work with web, came from clear Delphi - will find it useful. I will try to assume experience of this topic

 

                                                                                              

 

(Post #12, Mohammed Nasman) What is Session (shortly)?

 

Session -  instance of Application with Unique ID on the server

Session object, it's an object dictionary for each session instance, and it could be access within the application for the same (session id only).

 

(Post #26, myself) How Session Model works?

 

NoActivity from client Application (client went for coffebreak) - SessionTimeout Starts, if on ServerModule.SessionTimeOut was 20 minutes than after 20 minutes of NoActivity - Instance will be terminated and all data will be lost.

 

So to save users data we can use MainModule.OnSessionTimeout

 

AnyActivity? Application continues to work - SessionTimeOut countdown doesn't start

 

 

(Post #18, #20, Oscar, myself)  Oskar model

 

-keep session alive (by "doing something" with server or maybe with AllowTerminate:=false; like above)

-terminate session on Connection down to clean temporary files

-to put "false" CloseApp button, and on click not to terminate,  and real termination will be on closing browser tab

-to keep transactions in one event

 

My thoughts about it

 

If we have <100 users than keeping session always alive - it is Ok. But in general case...

Keeping session alive for all users may lead to big memory consumtion. So, lets take 32 bit Apps, 1 session, according to Mohhamed words - 10 MB.

-If 1 user will open App only in 1 Tab than it is 10 MB of RAM, 

-if 100 users will open App in 1 tab than ~ 1 GB, after 100 users as i understand its unpredictable!!!

-if 100 users will open App in 2 tabs than ~ 2 GB (will it work for 32 bit? Maybe. But OutOfMemory very possible), and for the Web it is normal to open different pages in many tabs - so here it could be problem for 32 bit.

 

So if to project big Application with high Load and many, many users, 32bit App - not Ok, but 64 bit.

 

(Post#25, Mohhamed) Mohhamed Model

 

- To set SessionTimeout beetwen 30 min and one hour is very reasonable time

- To not to keep Session Model always alive to save resources (RAM, Diskspace...)

 

My thoughts about it

-In general case it suites for <100 users and >100 users, so, seems to be universal.

 

My Practical Conclusions

-Set SessionTimeout in 45 min.

-Save users data on SessionTimeout

-Use 64 bit for >100 Users and in general case it gives more RAM resources

Link to post
Share on other sites

Activity from client? Sessions - continues. Application continues to work.

 

No Activity? SessionTimeout starts and Application will be terminated.

 

You are right, that's how session works, if there's no any activity session timeout will start count, any client actions, the timeout will reset.

Link to post
Share on other sites

Now that we are talking about sessions, is there a way to calculate bandwidth and connection speed? For example what is the demanded upload and download speed for hosting a unigui application?

 

look at server page for the application

 

http://server:8077/server

 

it's will show the sent and received bytes for the application

  • Upvote 1
Link to post
Share on other sites

Wow! Didn't know about that page! And what does mean Max Sessions and Max Requests on that page?

 

It works very interesting - if to open tab with UniGUI App than to close it Current Sessions doesn't decrease, only increasing.

 

If 1 user will open and Close tab for 1000 times than server will not load App to anyone - is it should be so or some mistake?

post-2378-0-47802900-1456171337_thumb.jpg

Link to post
Share on other sites

rgreat thanks ! Tested more, for most apps after closing tab it waits about 5 sec. than updating data on the server - decreasing number of sessions,, but in 1 App, that uses AllowTerminate it didn't decreased Sessions number.

Need to test more.

Link to post
Share on other sites
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...