# US 2015/0178055 A1 · Methods and systems for utilizing bytecode in an on-demand service environment including providing multi-tenant runtime environments and systems

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2015/0178055 A1
- Document ID: US20150178055A1
- Status: Published application
- Kind: A1
- Application number: 14/617,754
- Filed: 2015-02-09
- Published: 2015-06-25
- Earliest claimed: 2010-04-21
- Assignees: salesforce.com, inc.
- Applicants: salesforce.com, inc.
- Inventors: Gregory D. Fee; William J. Gallagher
- Web page: https://patentgrep.com/patent/US20150178055A1

## CPC

- G06F 8/41: Compilation
- G06F 9/5027: {the resource being a machine, e.g. CPUs, Servers, Terminals}
- G06F 12/0811: with multilevel cache hierarchies
- G06F 12/0875: with dedicated cache, e.g. instruction or stack
- G06F 16/172: Caching, prefetching or hoarding of files
- G06F 16/245: Query processing
- G06F 12/0866: for peripheral storage systems, e.g. disk cache
- G06F 2209/549: Remote execution
- G06F 2212/45: Caching of specific data in cache memory
- G06F 2212/465: Structured object, e.g. database record
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Execution of code in a multitenant runtime environment. A request to execute code corresponding to a tenant identifier (ID) is received in a multitenant environment. The multitenant database stores data for multiple client entities each identified by a tenant ID having one of one or more users associated with the tenant ID. Users of each of multiple client entities can only access data identified by a tenant ID associated with the respective client entity. The multitenant database is a hosted database provided by an entity separate from the client entities, and provides on-demand database service to the client entities. Source code corresponding to the code to be executed is retrieved from a multitenant database. The retrieved source code is compiled. The compiled code is executed in the multitenant runtime environment. The memory used by the compiled code is freed in response to completion of the execution of the compiled code.

## Claims

### Claim 1

A computer-implemented method for execution of code in a runtime environment, the method comprising:
receiving a request to execute code;
retrieving source code corresponding to the code to be executed from a database, wherein the source code is stored as an abstract syntax tree (AST) in a general-purpose distributed memory caching system;
compiling the retrieved source code to generate executable code;
translating the executable code to bytecode;
parsing the bytecode to find a selected portion of the bytecode to service a request;
executing the selected bytecode in the runtime environment;
freeing memory used by the selected bytecode upon completion of the execution of the selected bytecode so that the selected bytecode is not preserved in the memory after execution of the bytecode.

### Claim 2 (depends on 1)

The method of claim 1 wherein freeing the memory used by the selected bytecode in response to completion of the execution of the selected bytecode further comprises copying the selected bytecode to a first level cache memory.

### Claim 3 (depends on 2)

The method of claim 2 further comprising copying the selected bytecode from the first level cache memory to a second level cache memory.

### Claim 4 (depends on 3)

The method of claim 3 wherein the second level cache memory comprises memcached caching system.

### Claim 5 (depends on 2)

The method of claim 2 further comprising:
receiving a subsequent request to execute code corresponding to the selected bytecode stored in the first level cache memory;
retrieving the selected bytecode from the first level cache memory;
executing the selected bytecode in the runtime environment;
freeing the memory used by the selected bytecode in response to completion of the execution of the selected bytecode.

### Claim 6

A system to provide a runtime environment for execution of code, the system comprising:
a plurality of interconnected hardware server computing platforms;
a load-balancing agent communicatively coupled with the plurality of server computing platforms, the load balancing agent to receive a request to execute code, the load balancing agent to allocate execution of the code to a selected one of the plurality of server computing platforms;
the selected server computing platform, in response to the allocation from the load-balancing agent, to retrieve source code corresponding to the code to be executed from a database, wherein the source code is stored as an abstract syntax tree (AST) in a general-purpose distributed memory caching system, to compile the retrieved source code to generate executable code, to translate the executable code to bytecode, to parse the bytecode to find a selected portion of the bytecode to service a request, to execute the selected bytecode in the runtime environment, and to free memory used by the selected bytecode upon completion of the execution of the selected bytecode so that the selected bytecode is not preserved in the memory after execution of the bytecode.

### Claim 7 (depends on 6)

The system of claim 6 wherein freeing the memory used by the selected bytecode in response to completion of the execution of the selected bytecode further comprises the selected server computing platform copying the selected bytecode to a first level cache memory.

### Claim 8 (depends on 7)

The system of claim 7 further comprising the selected server computing platform copying the selected bytecode from the first level cache memory to a second level cache memory.

### Claim 9 (depends on 8)

The system of claim 8 wherein the second level cache memory comprises memcached caching system.

### Claim 10 (depends on 7)

The system of claim 7 further, wherein the selected server computing platform further receives a subsequent request to execute code corresponding to the selected bytecode stored in the first level cache memory, retrieves the selected bytecode from the first level cache memory, executes the selected bytecode in the runtime environment, and frees the memory used by the selected bytecode in response to completion of the execution of the selected bytecode.

### Claim 11

An article of manufacture comprising a non-transitory computer-readable medium having stored thereon instructions to cause one or more processors to provide execution of code in a runtime environment, the instructions, when executed, causing the one or more processors to:
receive a request to execute code;
retrieve source code corresponding to the code to be executed from a database, wherein the source code is stored as an abstract syntax tree (AST) in a general-purpose distributed memory caching system;
compile the retrieved source code to generate executable code;
translate the executable code to bytecode;
parse the bytecode to find a selected portion of the bytecode to service a request;
execute the selected bytecode in the runtime environment;
free memory used by the selected bytecode upon completion of the selected bytecode so that the selected bytecode is not preserved in the memory after execution of the bytecode.

### Claim 12 (depends on 11)

The article of claim 11 wherein the instructions that cause the one or more processors to free the memory used by the selected bytecode in response to completion of the execution of the selected bytecode further comprise instructions that, when executed, cause the one or more processors to copy the selected bytecode to a first level cache memory.

### Claim 13 (depends on 12)

The article of claim 12 further comprising instructions that, when executed, cause the one or more processors to copy the selected bytecode from the first level cache memory to a second level cache memory.

### Claim 14 (depends on 13)

The article of claim 13 wherein the second level cache memory comprises memcached caching system.

### Claim 15 (depends on 11)

The article of claim 11 further comprising instructions that, when executed, cause the one or more processors to:
receive a subsequent request to execute code corresponding to the selected bytecode stored in the first level cache memory;
retrieve the selected bytecode from the first level cache memory;
execute the selected bytecode in the runtime environment;
free the memory used by the selected bytecode in response to completion of the execution of the selected bytecode.

### Claim 16

A system to execute code in a runtime environment, the system comprising:
means for receiving a request to execute code;
means for retrieving source code corresponding to the code to be executed from a database, wherein the source code is stored as an abstract syntax tree (AST) in a general-purpose distributed memory caching system;
means for compiling the retrieved source code to generate executable code;
means for translating the executable code to bytecode;
means for parsing the bytecode to find a selected portion of the bytecode to service a request;
means for executing the selected bytecode in the runtime environment;
means for freeing memory used by the selected bytecode upon completion of the selected bytecode so that the selected bytecode is not preserved in the memory after execution of the bytecode.

### Claim 17 (depends on 16)

The system of claim 16 wherein the means for freeing the memory used by the selected bytecode in response to completion of the execution of the selected bytecode further comprise means for copying the selected bytecode to a first level cache memory.

### Claim 18 (depends on 17)

The system of claim 17 further comprising means for copying the selected bytecode from the first level cache memory to a second level cache memory.

### Claim 19 (depends on 17)

The system of claim 17 further comprising:
means for receiving a subsequent request to execute code corresponding to the selected bytecode stored in the first level cache memory;
means for retrieving the selected bytecode from the first level cache memory;
means for executing the selected bytecode in the runtime environment;
means for freeing the memory used by the selected bytecode in response to completion of the execution of the selected bytecode.
