NetTalk Central

Author Topic: About saving the session queues (with xfiles)  (Read 3556 times)

rainerwallenius

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
    • Email
About saving the session queues (with xfiles)
« on: April 25, 2015, 02:35:58 AM »
I have been experimenting with the technique introduced by Bruce at the webinar on thursday.

The idea is to save the sessions at shutdown, replace the binary, restart the server and load back the session queues, all without the users even noticing the service was down a few seconds.

No cigar yet

As Bruce suspected, there seems to be a problem with the session data queue, probably with the pointers to external values (string over 256 bytes I think it was).
There are quite a few of them, for instance browse filters, lastvalue, firstvalue and so on.
So now when the server reads in the data queue containing extvalues, this will lead to a crash.

This is the code at startup
  xml.Load(ThisWebServer._SessionQueue,'Session.xml','SessionQueue','row')
  xml.Load(ThisWebServer._SessionDataQueue,'Sessiondata.xml','SessionDataQueue','row')
  xml.Load(ThisWebServer._BrowseIdQueue,'BrowseIdQueue.xml','BrowseIDQueue','row')
  xml.Load(ThisWebServer._SettingsQueue,'SettingsQueue.xml','SettingsQueue','row')
  xml.Load(ThisWebServer._BrowseSettingsQueue,'BrowseSettingsQueue.xml','BrowseSettingsQueue','row')

In xml this might look like:
Code: [Select]
[font=Verdana][size=10pt]  <row>
    <SESSIONID>81B0Aq73Fte6TOuhAa4sANaHJBaFpn</SESSIONID>
    <TABID/>
    <NAME>henkilotaulu_filter_360032</NAME>
    <VALUE/>
    <PICTURE/>
    <VALUEFORMATTED>0</VALUEFORMATTED>
    <VALUEEXISTS>0</VALUEEXISTS>
    <EXTVALUESIZE>1024</EXTVALUESIZE>
    <EXTVALUELEN>1024</EXTVALUELEN>
    <EXTVALUE>Ø
b   </EXTVALUE>
  </row>
  <row>
    <SESSIONID>81B0Aq73Fte6TOuhAa4sANaHJBaFpn</SESSIONID>
    <TABID/>
    <NAME>henkilotaulu_firstvalue_360032</NAME>
    <VALUE/>
    <PICTURE/>
    <VALUEFORMATTED>0</VALUEFORMATTED>
    <VALUEEXISTS>0</VALUEEXISTS>
    <EXTVALUESIZE>1024</EXTVALUESIZE>
    <EXTVALUELEN>1024</EXTVALUELEN>
    <EXTVALUE>XTm   </EXTVALUE>
  </row>
  <row>
    <SESSIONID>81B0Aq73Fte6TOuhAa4sANaHJBaFpn</SESSIONID>
    <TABID/>
    <NAME>henkilotaulu_lastvalue_360032</NAME>
    <VALUE/>
    <PICTURE/>
    <VALUEFORMATTED>0</VALUEFORMATTED>
    <VALUEEXISTS>0</VALUEEXISTS>
    <EXTVALUESIZE>1024</EXTVALUESIZE>
    <EXTVALUELEN>1024</EXTVALUELEN>
    <EXTVALUE>ÈXm   </EXTVALUE>
  </row>[/size][/font]

Any ideas?

TIA
:: rainer

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: About saving the session queues (with xfiles)
« Reply #1 on: May 05, 2015, 02:31:56 AM »
hi Rainer,

It's possible to extend xFiles to store variables from pointers - that's covered in the xFiles docs, but to make things a bit easier I've built all of this into NetTalk for the 8.46 build.
So IF you have xFiles in the app (xfiles Global Extension) then you can set a new setting on the Performance tab, "Save server state between runs".

If this is set then the WebServer procedure will automatically add the code we went though in the webinar, plus the bit to handle the ExtValue into the WebServer procedure for you. I also combined all the xml files into a single xml file called ServerState.xml

8.46 should be up in the next couple of days.

cheers
Bruce

rainerwallenius

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
    • Email
Re: About saving the session queues (with xfiles)
« Reply #2 on: May 05, 2015, 04:01:03 AM »
Great news Bruce.

I managed to save sessiondata in a tps-file but a template-option is so much nicer!

:: rainer