KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Web Server Legacy sessions to Scalable Sessions Process Variables
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: September 4, 2024

A recent feature of the 4D Web Server is the introduction of multi-process sessions. This option can be set through the database settings and allows a single web session to use multiple processes. The classic behavior and setting is the legacy single process sessions which have each session run on a single process.
Changing the web server from the legacy single process sessions to multi-process session can cause process variables and process-based data to behave differently from before.

With the legacy sessions, because the entire session is run in a single process, process variables and table selections are maintained throughout the process as they are within the scope of the process. With the newer scalable sessions, each request can be its own process meaning that the information that is only maintained for the scope of a process is not shared.

Code and logic may need to be refactored to rely on the use of data that needs to be maintained over multiple web requests in a single session. The data can be changed so that they are reinitialized in each request or stored in an alternative way.

A way to share information for a session is to use the new Session object's storage property. Each session has its own Session object which has its own storage property which behaves similarly to the global Storage object. This allows it to be threadsafe through the use of the Use..end use sructure. Unlike the global Storage, the Session object and its storage property is only available to its own specific session and allows data for the session to be shared across multiple processes from the session.