4D v16.3

Using preemptive Web processes

Home

 
4D v16.3
Using preemptive Web processes

Using preemptive Web processes  


 

 

The built-in Web Server of 4D 64-bit for Windows and OS X allows you to take full advantage of multi-core computers by using preemptive Web processes in your compiled applications. You can configure your Web-related code, including 4D tags and Web database methods, to run simultaneously on as many cores as possible.

For more information on preemptive process feature in 4D, please refer to the Preemptive 4D processes section.

The use of preemptive mode for Web processes is only available in the following contexts:

  • use of a 64-bit version of 4D
  • use of 4D Server or 4D local mode (4D in remote mode does not support preemptive mode)
  • use of a compiled database
  • Use preemptive processes database setting checked (see below)
  • all Web-related database methods and project methods are confirmed thread-safe by 4D Compiler

If any requirement is missing, the Web Server will use cooperative processes.

To enable the preemptive mode for the Web Server code of your application, you must check the Use preemptive processes option on the "Web/Options (I)" page of the Database Settings dialog box:

When this option is checked, the 4D compiler will automatically evaluate the thread-safety property of each piece of Web-related code (see below) and return errors in case of incompatibility.

All 4D code executed by the Web Server must be thread-safe if you want your Web processes to be run in preemptive mode. When the Use preemptive processes option is checked in the Database Settings dialog box, the following parts of the application will be automatically evaluated by the 4D compiler:

For each of these methods and code parts, the compiler will check if the thread-safety rules are respected, and will return errors in case of issues. For more information about thread-safety rules, please refer to the Writing a thread-safe method paragraph.

Starting with 4D v16, most of the Web-related 4D commands, database methods and URLs are thread-safe and can be used in preemptive mode:

All 4D Web-related commands are thread-safe, i.e.:

The following database methods are thread-safe and can be used in preemptive mode:

Of course, the code executed by these methods must also be thread-safe.

The following 4D Web Server URLs are thread-safe and can be used in preemptive mode:

  • 4daction/ (the called project method must also be thread-safe)
  • 4dcgi/ (the called database methods must also be thread-safe)
  • 4dscript/ (deprecated as URL, used as a tag)
  • 4dwebtest/
  • 4dblank/
  • 4dstats/
  • 4dhtmlstats/
  • 4dcacheclear/
  • rest/
  • 4dimgfield/ (generated by PROCESS 4D TAGS for web request on picture fields)
  • 4dimg/ (generated by PROCESS 4D TAGS for web request on picture variables)

The following 4D Web Server URLs are not thread-safe and not supported in preemptive mode:

  • 4dsync
  • 4dsqlauth (deprecated, used for Flex 1.1)

Both the Runtime Explorer and the 4D Server administration window display a specific icon for preemptive Web processes:

Process typeIcon
Preemptive Web method



See also 


Preemptive 4D processes

 
PROPERTIES 

Product: 4D
Theme: Web Server

 
HISTORY 

New
Created: 4D v16

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)