How do Site Properties work "under the hood"?

How do Site Properties work "under the hood"?

  
I am curious about the way Site Properties (and Session Properties too) work "under the hood".

Specifically, do they get read from the database:

* Once per page view
* Every time they are accessed
* Once when IIS is started

In other words, if I have many Actions on the same page referring to the same Site Property, is there a performance advantage to using a Site Property instead of storing that setting in the database?

Thanks!

J.Ja
Yup, I like to know that too.
I have some educated guesses (session-variables == viewstate/controlstate in .net, and site-properties are application-state variables in .net)

Hi,

Site properties are cached in the applications after the first access. You can notice them listed in the ESpaceInvalidateCache action help page. Also, since version 7.0, changing a value on a site property at runtime automatically triggers a ESpaceInvalidateCache at the end of the request. This is also explained in the Site properties help page.

Session variables are stored in the session database (you guessed wrong :P, no viewstate). This is explained in the Session Variables help page as well.
They are read from the session database when accessed and written in the end of the request if needed.
For performance reasons reads and writes are done per eSpace. So if at least 1 variable from an eSpace is necessary in a request, then all the variables defined in that eSpace will be fetched in bulk.

Regards,
João Rosado
Joao -

Fantastic information, thanks! Just what I hoped to hear.

J.Ja
:thumbsup:

excellent info!

Great
Hi all,

Now I'm the curious one :)

João's reply basically uses public available information on the online reference.
My curiosity centers on 'Why didn't you reach it?' and I'd like your help to figure it out.

Please get back and choose from the following (one or more):
  1. Didn't occur to me that this info would be available on the reference help.
  2. Didn't look into the reference help 'cause the information there is not accurate or updated.
  3. I gave up on looking into the reference help long time ago 'cause it is too hard to read/search/understand.
  4. Didn't search for it in the community 'cause I never find anything anyhow.
  5. Didn't search for it in the community 'cause I didn't know I could search the community.
  6. I searched on Google/Bing/Yahoo but didn't get good results...
  7. Other.... (add your own reasoning)

Thank you very much!
With your help we will make a better product and community!


PS: If you prefer you can PM me.

Cheers
In fact this question was in my 'doubts list'. When I received the Mail Digest with the title 'How do Site Properties work "under the hood"?' I came and found the usefull Joao's reply.
Hi,

1. I rarely get the right info on the reference help.


2. when i look in service studio help, i get the following result:
http://www.outsystems.com/community/CommunitySearch.aspx?SearchQuery=site%20proprties&Index=0&Collection=3&WithAllWords=&ExactPhrase=&WithoutWords=&FileType=0&FilterResults=1&CollectionStr=


when I search on the community i get too many results and also very old. I never know which is latest and which is too old
Hi Joost,

You actually have a typo in your search. Did you miss the 'Did you mean' suggestion?


Do you actually use the tabs to filter results from the Reference Help?
One thing that isn't mentioned, is that when the site-property is in a producer eSpace, the consumer's cash is not refreshed. A redeploy of the consumer is necessary in that case. (This may have changed in v8, I didn't check recently).
Hi Killian,

Thats actually not correct.
Before 7.0 you needed to call the invalidate cache action manually after changing the site property. On 7.0+ the cache invalidation of both producers and consumers regarding the affected site properties is done automatically on the end of the request, if necessary.

On what version were you experiencing that behavior?

Regards,
João Rosado
Hi João,

We recently upgraded from 6 to 8, so I that was why I mentioned not being sure for 8 (should've mentioned 7 as well). However, I'm absolutely sure that that on 6, the cache for the eSpace owning the site properties is refreshed (perhaps even on 5?).
André Vieira wrote:
Hi Joost,

You actually have a typo in your search. Did you miss the 'Did you mean' suggestion?


Do you actually use the tabs to filter results from the Reference Help?
 Sorry I was in a hurry, but the focus is not with "did you mean"
I just spot there are no results and that is it.
Then I just hit search again, because it is prefilled (with what I expect is the new suggestion)

(Why do I have the feeling I am doing cheap-live with you ;) )

The answer your 2nd question:
I sometimes use the tabs, yes
 But I still miss timestamps on the forums-results, because I want to know if the discussion is relevant.
(everything that is older than 2012 is prolly outdated with the improvements of SS)

I too have had issues not seeing the dates on the posts... a lot of information is outdated, or no longer relevant, because the post was made in version 4. :(

J.Ja
André Vieira wrote:
João's reply basically uses public available information on the online reference.
My curiosity centers on 'Why didn't you reach it?' and I'd like your help to figure it out.
Funny you mention this, as I was just now searching & skimming for the information about how site properties are stored internally.

In this particular case, my first approach was precisely to search in the online help pages, and I even passed by the page “About Site Properties” but dismissed it as irrelevant for my query… remember, I skimming for info, not reading back-to-back!

In that page the information João mentions is under the header “Multi-Tenant Applications”… I don’t care about multi-tenant as it doesn’t apply to my project, so I moved on.

Searching the community shows me a 'How do Site Properties work "under the hood"?' in the first page, which is exactly what I’m looking for.

In the online help page about Session Variables, the database in a header called “User-defined Session Variables”, in a paragraph that starts by explaning they “should be used with care since they can affect the scalability”… 

Just because it’s written, does’t mean it’s in a place that’s easy to find :)

Cheers

-- 
Hugo
Hi Hugo,

Thank you for your feedback. Hopefully we will improve this in the future and make your experience searching for information much better. Please keep the feedback coming!

Cheers
Hi,
I've just found this post after João Rosado's help in directing me here.

So, changing a value on a site property at runtime: it automatically triggers a ESpaceInvalidateCache at the end of the request, of both producers and consumers regarding the affected site properties. This means all consumer eSpaces, if more than one or just the one Consumer that changes the site property?

Regarding André Vieira's remarks, I must say this is not mentioned in the Help (which I have read carefully).
What it says in the Help (http://www.outsystems.com/help/servicestudio/9.0/default.htm#Language_Reference/About_Site_Properties.htm) is that "... whenever the cache is invalidated, all the site properties are also re-evaluated." under the title "Multi-Tenant Applications" - but doesn't mention how the cache is invalidated: if it's automatically or by explicitly using ESpaceInvalidateCache Action.
All consumers are invalidated.
If that is not the behavior that you are experiencing, please make a solution example and we will take a look at it.

Regards,
João Rosado