Tuesday, September 10, 2013

How to Tune XML Related Memory and Performance Issues?

Issues related to run time memory or run space memory issues can cause Performance issues at Java/XML Application level which is running at Oracle Database Server or Application Tier.  Errors like ORA-29554 or OutOfMemory can occur when called from XML based Applications.

You can try to increase the runtime memory space while using XSU API or XML DB or DBMS_XML based packages, XMLparsers/XDB are bundled into Oracle Database.  Mostly for XML applications increasing MaxMemorySize and MaxRunspaceSize should help.

XML Parsers are not standalone products in Oracle and there is no separate fix at parser level.  Since Oracle 10g release to XML packages got integrated into Oracle Database as XDB.

1. Memory Tuning on the Database Server Side:

Mostly for XML applications increasing MaxMemorySize and MaxRunspaceSize should help.

To increase the Memory values:

- First, you would need to create Memory Functions, these functions will alllow us to increase MaxMemorySize:

create or replace function getMaxMemorySize return number
is language java name
'oracle.aurora.vm.OracleRuntime.getMaxMemorySize() returns long';
/

create or replace function setMaxMemorySize(num number) return number
is language java name
'oracle.aurora.vm.OracleRuntime.setMaxMemorySize(long) returns long';
/

- Likewise, you would need to create Runspace Functions,  these functions will allow us to increase MaxRunspaceSize:

create or replace function getMaxRunspaceSize return number
is language java name
'oracle.aurora.vm.OracleRuntime.getMaxRunspaceSize() returns long';
/
create or replace procedure setMaxRunspaceSize(num number)
is language java name
'oracle.aurora.vm.OracleRuntime.setMaxRunspaceSize(long)';
/

To check the existing values (you would still need to create the above functions to check the current values):

select getmaxmemorysize from dual;

select getmaxrunspacesize from dual;

To Set the Values:

To increase MaxRunspaceSize to 250 MB:

begin
/* Add this line to increase the runspacesize 250 MB */
setmaxrunspacesize(250000000);
end;
/

(OR)

exec setMaxRunspaceSize(250000000);

To increase MaxMemorySize 500 MB:

SQL> select setMaxMemorySize(500000000) from dual;

2. Database memory related parameters such as shared_pool_size and java_pool_size (init.ora parameters), values should help with Application based memory or performance issues.  Try to double your current values.  You can use 'alter system' commands to change these values.

-- To show the current value:

SQL> show parameter pool;

3. You can also set Oracle JAVAVM init.ora parameters - java_soft_sessionspace_limit and java_max_sessionspace_size and parameter 'java_jit_enabled' should be set to true

-- To show the current value:

SQL> show parameter java;

4. If the executable involves any Java or JVM then increasing the maximum parameter size Xmx and Xms.

i.e., if there is not enough memory on the JVM to load a data file of larger size.

For example: -Xmx128m to have 128MB and Xmx1024m to have 1024MB

java -server -Xms1024m Xmx1024m

Thanks.

No comments:

Post a Comment