The P-code cache in detail

To process procedures, the executable procedure code must be in the main memory. conzept 16 only loads the code from the database that is actually required. Using this method, a procedure can be executed independently of the available memory resources; the developer does not need to worry about code management. For certain applications, it is nevertheless helpful to know the mechanisms of the P-code cache.


Generation of procedure code and runtime data

The P-code generated during the translation of a procedure is not stored in one piece, but consists of a number of 2 KB code blocks that can later be managed independently of each other. Additional metadata is required to execute the individual functions. This metadata is also generated during procedure translation, but is stored separately from the procedure code in the database. This metadata includes, for example, the names, argument types and start addresses of the individual sub-functions, names and sizes of the global data areas and variable information for the debugger.

Loading and executing

Before the first instruction of a procedure is executed, the basic metadata for the subfunctions must first be loaded. The name of the sub-function is used to determine the start address and therefore the required code block for the procedure. This code block is then loaded from the database into the P-code cache if it is not already there. Processing of the P-code then starts. Each time the program jumps from the current code block, the required code block is determined using the target address and then loaded.

Cache management

There is a common buffer memory for the code blocks of all procedures, the size of which is independent of the total amount of procedure code in the database. The buffer fills up automatically during the course of the procedure calls. If the buffer is completely filled, the longest unused block is removed from the buffer when another code block is loaded. If the buffer size is too small, the same code blocks have to be loaded several times during processing, which naturally slows down processing speed and increases network traffic. From version 5.7.08, the maximum amount of buffered metadata is linked to the buffer size. In all previous versions there is a static restriction.

Standard sizes

The default size is defined differently depending on the client type. The default size depends on how many instances of the P-code cache there typically are on a computer and whether procedures for the GUI are also executed. As of version 5.7.08, there are therefore three different size specifications (the API DLL does not use a standard size):

8 MB (GUI / few instances)

– Standard Client
– Advanced Client
– 3.x Client
– Jobs in these clients

2 MB (without GUI / many instances)

– SOA
– Jobs in SOA Service
– PHP
– Print processor
– Server

256 KB (without GUI / no separate address space)

– ODBC
– Web interface

Changing the buffer size

With two new properties of the _Sys object, the current size of the P-code cache can be queried and changed (_Sys->spProcCacheLimitKB), and the current buffer allocation can also be determined (_Sys->spProcCacheKB). The buffer can be enlarged or reduced during operation. The maximum size is 64 MB, the minimum is 256 KB.

More buffer

It makes sense to enlarge the buffer if significantly more code is loaded within an application component than fits into the standard buffer. To determine this quantity, for example, the application is started, the P-code cache is set to maximum size _Sys->spProcCacheLimitKB # (1024 * 64) and the most important functions of a component are executed. Finally, the current size is queried. The client must then be restarted for the next application component, as otherwise the previously loaded procedure code will naturally remain in the buffer. The values determined can then be used to decide whether a higher maximum value is appropriate for the application. This should then be set within the initialization procedure of the application. Alternatively, the limit for the SOA service can also be set in the configuration file of the task.

Less buffer

Reducing the buffer is only necessary in cases where a large number of instances are running simultaneously and little memory is available, for example with numerous database users in the SOA socket task or many jobs in the standard or advanced client.

Klicken Sie hier, um die Nutzungsbedingungen für unseren Blog zu lesen.

Leave a Reply

Your email address will not be published. Required fields are marked *

Leave the field below empty!

Requests, questions or feedback are welcome:

Terms of use of the comment function in the blog

1. General information

Vectorsoft AG (‘Provider’) provides a public blog for Internet users (‘Users’) on the vectorsoft.de website. The public blog is intended for the exchange of information and ideas. Users who participate with contributions and comments undertake to comply with the blog terms of use and are responsible for the accuracy, appropriateness and freedom from legal infringements of their contributions. By using the comment function in our blog, you accept these terms of use.

2. Netiquette

We ask you to refrain from personal attacks and provocations based on other opinions. Please argue objectively and maintain a constructive discussion culture. Your comment should always be related to the topic in question in order to avoid digressions into other topics. Posting the same comment or several similar comments more than once is not permitted.

3. Prohibition of illegal content

By submitting your comment, you confirm that you are not violating any copyrights or other rights of third parties. Inciting, racist statements, instructions for criminal offences and their glorification, depictions of violence, pornographic content and statements that violate personal rights are prohibited.

4. No advertising

The use of the comment function is not permitted for commercial or party-political purposes. Advertising contributions of any kind will be deleted immediately.

5. Details of the name

When entering your name, pay attention to the principles mentioned above.

6. Source references

If you intend to publish quotes or contributions from third parties, please indicate the respective sources and explain how they relate to the blog post.

7. Violation of the terms of use

Posts that violate this policy will be deleted immediately. If you notice any violations yourself, please send us the link to the comment in question by e-mail to . We expressly point out that we will exclude individual users in the event of repeated or serious violations of these terms of use.

As of: Sept. 2024

Get your Trial Version now!

Test yeet free of charge

IHRE EVALUIERUNGSLIZENZ - JETZT ANFORDERN!

TESTEN SIE DIE CONZEPT 16 VOLLVERSION - UNVERBINDLICH und KOSTENFREI

Subscribe to our newsletter

[cleverreach_signup]
WordPress Cookie Notice by Real Cookie Banner