Keynote - 4D v11 Server In Depth
09/10/08 21:49 Filed in: 4D Summit
2008
Morning
Keynote:
4D v11 in Depth: Laurent Rebardiere
Server Optimization:
4D Server has been prepared for WAN connections. Most of the 4D Language commands now rely on only one request. Previous versions would make several trips to the server for every command.
In his demo, Laurent showed a client performing a request to set the read write status of four tables, query, relate a table, update a value and save he modified record.
in v2004, the method took about 34 seconds.
In v11, the method took 6 seconds.
List Display Optimizations:
v11 Detects what fields are used for display and for formulas. It retrieves only these fields from the server (not the entire record).
v11 also retrieves only the displayed data from the server. In one request it will give you the data displayed on one page, even if he displayed page has data from a related table.
v2004 needed two redraws, v11 only needs one.
Sets and Named Selections:
Sets and Named Selections “stick” to where they are used. (Client or Server).
Partial caching occurs transparently.
“$” or”<>” signs are now used for namespace only.
New: Local Named Selections:
Push on Clients:
Example of Add vs. Justin. Justin keeps bothering Brendan asking “What can I do? Do ou have any jobs for me?” (polling) Add sits in his office and waits for Brendan to come and tell him to do something. (push).
4D Client now relies on push technology to manage client updates and execution) This greatly reduces the number of requests from the Client to the Server.
Also improves the reliability of notifications about shutdown, resource updates, etc.
Client Server logging:
Yu can ask 4D Server to activate a log (external text file). This is available for all three servers:
- Application Server
- DB4D Server
- SQL Server
From Monitor Window
Set Database Parameter(4D Server Log Recording;(28))
This is available in the Maintenance window of the 4D Server Console
Laurent demonstrated the log as it monitored a request from the client.
Code Execution on Client or Server:
Query by Formula and Order by Formula: on v2004 these commands were very inefficient, cince the took place on the client and required loading all f teh records in the current selection. v11 performs the query or sort on the server.
Varibles used in the formula are evaluated on the client
Variables used inside a method are evaluated on server.
There is a compatibility checkboxyou can turn on when ou are ready to migrate to the v11 approach.
Set Database Parameter lets you choose speed over compatibilty on a table by table basis.
Demo of Query by Formula:
Used the Set Database Parameter command to switch the location of the query to the server. Big performance gain.
Triggers:
In v2004 trigers are execured on the server in the twin process. Twin processes share transaction state and record locks.
in v11 there is no more client/server synchronization for current selection and other tables in the current process.
The twin process now has its OWN set of process variables in compiled mode.
With v11, execution of triggers does not block other processes anymore. Not synchronous. So don’t rely on this behavior to support your business logic anymore.
Execute on Client:
Introduced in v6.5
Let you execute a method w/ parameters on an arbutrary client or set of clients.
v11 uses push for efficiency (the delay parameter is not used)
You can use it to do ‘Push’ yourself from the server to your client(s)
Execute on Server Command:
Launches a new independant process on the server
You need to use the Get Process Variable or records to exchage results
You need to use a global emaphore or flag to wait for termination.
Demo:
Travel Agency Database. Add a new flight to the quote.
There is a new method property (checkbox) for Execute on Server. Call your project method the normal way.
The method is executed on the server in the twin process.
The client waits for completion
All parameteters are sent and the $0 is retrieved.
Remember: the twin process is the same process as for triggers.
CPU Load vs. Network Load:
Execute on server is fine to minimize requests
Also useful to offer high level services
Instead of having Create record, Save Record + validation with a trigger, you can have a Create Record() method executed on server.
Be mindful of the costs and benefits of this approach, don’t stuff everything onto the server if you have 100 users creating lots of records. It will choke the CPU on the server
4D is really Four Servers in One
Application Server
- Login, Resources Management and Language
- Communicates on port 19813
Database Server
SQL Server
HTTP Server
Multitasking: Multicore System:
Multithread?
Multitasking inside one application
- Divides the work within an application into separate prcesses (threads)
Preemptive: all threads can be sent to available cores for sncronous processing.
Cooperative: asyncronous. Threads must queue up and wait for one to finish before being releases to the CPU.
All cooperative threads will spahe one core in a multicore system
in 4D the following are done in a coo[erative thread:
- All User interface is done in cooperatie thread
- Al language processes
- Stored Procedures
- All HTP requests
- Application Server
- DB4D (Database Access)
The following run preemptively:
- Index Builder
- Flush Data
- SQL Server
Minimizing Contention:
One data file is shared among multiple threads
Syncronization between the threads is expensive.
Demo:
v2004 Single User:
Sequential Search: with 1 process 8821 - With 5 Processes: 30305
Index Sort: With 1 process 2449 : With 5 processes: 10398
Sequential Sort: With 1 process: 22970 With 5 Processes
v11 Single User
Sequential Search: with 1 process 1038 - With 5 Processes: 4843
Index Sort: With 1 process 753 : With 5 processes: 3525
Sequential Sort: With 1 process: 1367 With 5 Processes 5995
v11 Server
Sequential Search: with 1 process 951 - With 5 Processes: 2196
Index Sort: With 1 process 822 : With 5 processes: 1750
Sequential Sort: With 1 process: 1332 With 5 Processes 2726
V11 Server is much faster. The v11 Server is really good at distributing work between multiple CPUs (as long as you aren’t using any 4D commands).
The other bottleneck is disk access. If you have alot of processes that access the disk, they will wait for the thread to load data. They will do some testing with Solid State Disks to see how this effects performance. They are going to test out a 500 user system and will see whether the SSD makes a big difference to performance.
Unicode
Unicode Concepts:
In Unicode every character has a unique format and code
U+0041 = A
Glyphs - Visual representatio of a character, two codes might share the same glyph (i.e. U=0061 and U+0430 are both “a&rdquo
Chinese, Japanese, Korean and Vietnamese are regarded ase one script, w/lots of characters.
Planes:
UTF-16 is a character encoding
Surrogates - A pair of two code points on the BMP that points to another code point on a higher plane
Combining Characters - Code Points that add a feature to a previously referenced character. (i.e. accents)
ICU Component:
Contains an XLIFF Editor for creation of localized databases.
4D v11 in Depth: Laurent Rebardiere
Server Optimization:
4D Server has been prepared for WAN connections. Most of the 4D Language commands now rely on only one request. Previous versions would make several trips to the server for every command.
In his demo, Laurent showed a client performing a request to set the read write status of four tables, query, relate a table, update a value and save he modified record.
in v2004, the method took about 34 seconds.
In v11, the method took 6 seconds.
List Display Optimizations:
v11 Detects what fields are used for display and for formulas. It retrieves only these fields from the server (not the entire record).
v11 also retrieves only the displayed data from the server. In one request it will give you the data displayed on one page, even if he displayed page has data from a related table.
v2004 needed two redraws, v11 only needs one.
Sets and Named Selections:
Sets and Named Selections “stick” to where they are used. (Client or Server).
Partial caching occurs transparently.
“$” or”<>” signs are now used for namespace only.
New: Local Named Selections:
Push on Clients:
Example of Add vs. Justin. Justin keeps bothering Brendan asking “What can I do? Do ou have any jobs for me?” (polling) Add sits in his office and waits for Brendan to come and tell him to do something. (push).
4D Client now relies on push technology to manage client updates and execution) This greatly reduces the number of requests from the Client to the Server.
Also improves the reliability of notifications about shutdown, resource updates, etc.
Client Server logging:
Yu can ask 4D Server to activate a log (external text file). This is available for all three servers:
- Application Server
- DB4D Server
- SQL Server
From Monitor Window
Set Database Parameter(4D Server Log Recording;(28))
This is available in the Maintenance window of the 4D Server Console
Laurent demonstrated the log as it monitored a request from the client.
Code Execution on Client or Server:
Query by Formula and Order by Formula: on v2004 these commands were very inefficient, cince the took place on the client and required loading all f teh records in the current selection. v11 performs the query or sort on the server.
Varibles used in the formula are evaluated on the client
Variables used inside a method are evaluated on server.
There is a compatibility checkboxyou can turn on when ou are ready to migrate to the v11 approach.
Set Database Parameter lets you choose speed over compatibilty on a table by table basis.
Demo of Query by Formula:
Used the Set Database Parameter command to switch the location of the query to the server. Big performance gain.
Triggers:
In v2004 trigers are execured on the server in the twin process. Twin processes share transaction state and record locks.
in v11 there is no more client/server synchronization for current selection and other tables in the current process.
The twin process now has its OWN set of process variables in compiled mode.
With v11, execution of triggers does not block other processes anymore. Not synchronous. So don’t rely on this behavior to support your business logic anymore.
Execute on Client:
Introduced in v6.5
Let you execute a method w/ parameters on an arbutrary client or set of clients.
v11 uses push for efficiency (the delay parameter is not used)
You can use it to do ‘Push’ yourself from the server to your client(s)
Execute on Server Command:
Launches a new independant process on the server
You need to use the Get Process Variable or records to exchage results
You need to use a global emaphore or flag to wait for termination.
Demo:
Travel Agency Database. Add a new flight to the quote.
There is a new method property (checkbox) for Execute on Server. Call your project method the normal way.
The method is executed on the server in the twin process.
The client waits for completion
All parameteters are sent and the $0 is retrieved.
Remember: the twin process is the same process as for triggers.
CPU Load vs. Network Load:
Execute on server is fine to minimize requests
Also useful to offer high level services
Instead of having Create record, Save Record + validation with a trigger, you can have a Create Record() method executed on server.
Be mindful of the costs and benefits of this approach, don’t stuff everything onto the server if you have 100 users creating lots of records. It will choke the CPU on the server
4D is really Four Servers in One
Application Server
- Login, Resources Management and Language
- Communicates on port 19813
Database Server
SQL Server
HTTP Server
Multitasking: Multicore System:
Multithread?
Multitasking inside one application
- Divides the work within an application into separate prcesses (threads)
Preemptive: all threads can be sent to available cores for sncronous processing.
Cooperative: asyncronous. Threads must queue up and wait for one to finish before being releases to the CPU.
All cooperative threads will spahe one core in a multicore system
in 4D the following are done in a coo[erative thread:
- All User interface is done in cooperatie thread
- Al language processes
- Stored Procedures
- All HTP requests
- Application Server
- DB4D (Database Access)
The following run preemptively:
- Index Builder
- Flush Data
- SQL Server
Minimizing Contention:
One data file is shared among multiple threads
Syncronization between the threads is expensive.
Demo:
v2004 Single User:
Sequential Search: with 1 process 8821 - With 5 Processes: 30305
Index Sort: With 1 process 2449 : With 5 processes: 10398
Sequential Sort: With 1 process: 22970 With 5 Processes
v11 Single User
Sequential Search: with 1 process 1038 - With 5 Processes: 4843
Index Sort: With 1 process 753 : With 5 processes: 3525
Sequential Sort: With 1 process: 1367 With 5 Processes 5995
v11 Server
Sequential Search: with 1 process 951 - With 5 Processes: 2196
Index Sort: With 1 process 822 : With 5 processes: 1750
Sequential Sort: With 1 process: 1332 With 5 Processes 2726
V11 Server is much faster. The v11 Server is really good at distributing work between multiple CPUs (as long as you aren’t using any 4D commands).
The other bottleneck is disk access. If you have alot of processes that access the disk, they will wait for the thread to load data. They will do some testing with Solid State Disks to see how this effects performance. They are going to test out a 500 user system and will see whether the SSD makes a big difference to performance.
Unicode
Unicode Concepts:
In Unicode every character has a unique format and code
U+0041 = A
Glyphs - Visual representatio of a character, two codes might share the same glyph (i.e. U=0061 and U+0430 are both “a&rdquo

Chinese, Japanese, Korean and Vietnamese are regarded ase one script, w/lots of characters.
Planes:
UTF-16 is a character encoding
Surrogates - A pair of two code points on the BMP that points to another code point on a higher plane
Combining Characters - Code Points that add a feature to a previously referenced character. (i.e. accents)
ICU Component:
Contains an XLIFF Editor for creation of localized databases.