Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> UTL_RAW and slowness
Hi all,
I am experimenting with a block of pl/sql code (wrote myself) that uses utl_raw to perform xor operation. (Note to Jared and Mladan, I can't use Perl on production boxes, so don't even go there).
I take a message, encrypt 1 character send it out on a wire using utl_tcp. After every 128 bytes, I flush the tcp connection. While this works fine and within our acceptable range for smallish messages (up to 20-25K in size), it nearly kills itself when working with larger messages (80k+).
Initially I could encrypt 128 characters (including conversion from/to utl_raw) in about 50ms. Bt this increase progressively. When I reach about 98000 to 99000 range, it takes about 16 seconds to encrypt 128 characters.
I have logged tar with Oracle, but does anyone know if one could do a block encryption (can't use standard algorithms, this is custom) like encrypt 128 characters at a time instead of 1 ...
The skeleton code looks like this ...
msglen := LENGTH (msg_text);
nCharsSent := 0;
p('Encrypting data...');
FOR i IN 1 .. msglen
LOOP
ntcpchar := ASCII (SUBSTR (msg_text, i, 1));
r_chr := utl_raw.cast_to_raw(CHR(ntcpchar));
nenctcpchar := TO_NUMBER(utl_raw.bit_xor(r_chr,r_key),'xxxx');
tcpmsglen := UTL_TCP.write_text (gv_tcp_conn, CHR(nenctcpchar), NULL);
nCharsSent := nCharssent + 1;
IF MOD(ncharssent,128) = 0 THEN
p('Before Flush ...');
UTL_TCP.FLUSH (gv_tcp_conn);
p('Connection Flushed at ' || ncharssent);
END IF;
--
END LOOP; -- FOR i IN 1 .. msglen
where p is a procedure that dumps supplied text to a trace file with a timestamp that is up to 1 ms resolution. BTW this is a 9202 box. Also when it starts getting slow, using "nmon" I can see that this process is hogging a CUP at 99-100%. Of course this is a dev box, but my SA will not like this on a production box.
Any ideas?
Thanks in advance
Raj
**************************************************************************************5
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Jamadagni, Rajendra
INET: Rajendra.Jamadagni_at_espn.com
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Thu Oct 23 2003 - 16:54:33 CDT
![]() |
![]() |