- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
CONNECTION POOLING AND CACHING in Font
CHAPTER 14 CONNECTION POOLING AND CACHING Code 3 Of 9 Creation In None Using Barcode creator for Font Control to generate, create Code-39 image in Font applications. www.OnBarcode.comUPC - 13 Maker In None Using Barcode maker for Font Control to generate, create GS1 - 13 image in Font applications. www.OnBarcode.compoolConfigProps.put(OracleOCIConnectionPool.CONNPOOL_MIN_LIMIT, "2") ; poolConfigProps.put(OracleOCIConnectionPool.CONNPOOL_INCREMENT, "1") ; poolConfigProps.put(OracleOCIConnectionPool.CONNPOOL_MAX_LIMIT, "20") ; cpool.setPoolConfig(poolConfigProps); System.out.println ("Min poolsize Limit = " + cpool.getMinLimit()); System.out.println ("Max poolsize Limit = " + cpool.getMaxLimit()); System.out.println ("Connection Increment = " + cpool.getConnectionIncrement()); Up until this point, this program is the same as the single-threaded program, AnalyzeOCI ConnPoolSingleThread, which we saw in the previous section. After this, we create the number of threads as specified by the command-line parameter and start them. Thread [] threads = new Thread[ _numOfSessionsToOpen ]; for( int i = 0; i<threads.length; i++ ) { (threads[i] = new WorkerThread( cpool, i )).start(); } Finally, we wait for all threads to finish in a loop. This ends the main() program, which is followed by the definition of the _getNumOfSessionsToOpen() method at the end: // wait until all threads are done. for( int i = 0; i<threads.length; i++ ) { threads[i].join(); } cpool.close(); }// end of main private static int _getNumOfSessionsToOpen( String[] args ) { int numOfSessionsToOpen = 6; //by default open 6 sessions if( args.length == 1 ) { numOfSessionsToOpen = Integer.parseInt( args[0] ); } System.out.println("Total number of sessions to open for " + "scott and benchmark = " + numOfSessionsToOpen); return numOfSessionsToOpen; } private static int _numOfSessionsToOpen; } Making UPC A In None Using Barcode generation for Font Control to generate, create UCC - 12 image in Font applications. www.OnBarcode.comEncode Barcode In None Using Barcode creator for Font Control to generate, create Barcode image in Font applications. www.OnBarcode.comCHAPTER 14 CONNECTION POOLING AND CACHING
Make EAN / UCC - 14 In None Using Barcode printer for Font Control to generate, create EAN128 image in Font applications. www.OnBarcode.comDraw Barcode In None Using Barcode creator for Font Control to generate, create Barcode image in Font applications. www.OnBarcode.comWe will run the program and then examine the database while the program is running. For some reason, the only reliable results our original query shows are the number of connections and the number of sessions. I modified the query to print out this information (note that the following query works only for the case in which we know that sessions are being independently created on top of connections, as is the case here). The program output is as follows: B:\> java AnalyzeOCIConnPoolMultiThread 12 Total number of sessions to open for scott and benchmark = 12 Min poolsize Limit = 2 Max poolsize Limit = 20 Connection Increment = 1 connecting as scott connecting as benchmark connecting as scott connecting as benchmark connecting as scott connecting as benchmark connecting as scott connecting as benchmark connecting as scott connecting as benchmark connecting as scott connecting as benchmark The program opens six sessions for SCOTT and six more for BENCHMARK. When I ran the modified query and executed it immediately again and again, it gave the following results: sys@ORA10G> select num_of_conns, (conns_plus_sess -num_of_conns) as num_of_seons 2 from 3 ( 4 select count(*) conns_plus_sess, 5 count( distinct p.spid) num_of_conns 6 from v$session s, v$process p 7 where s.type != 'BACKGROUND' 8 and s.username != 'SYS' 9 and p.addr(+) = s.paddr 10 ); NUM_OF_CONNS NUM_OF_SESSIONS ------------ --------------8 12 sys@ORA10G> / NUM_OF_CONNS NUM_OF_SESSIONS ------------ --------------8 12 sys@ORA10G> / ANSI/AIM Code 128 Creator In None Using Barcode generator for Font Control to generate, create Code 128 Code Set B image in Font applications. www.OnBarcode.comCreating ABC Codabar In None Using Barcode generation for Font Control to generate, create Ames code image in Font applications. www.OnBarcode.comCHAPTER 14 CONNECTION POOLING AND CACHING
Recognize Code 3 Of 9 In Java Using Barcode scanner for Java Control to read, scan read, scan image in Java applications. www.OnBarcode.comCode39 Creator In Java Using Barcode generation for Android Control to generate, create Code 39 Extended image in Android applications. www.OnBarcode.comNUM_OF_CONNS NUM_OF_SESSIONS ------------ --------------12 12 <-- after some time --> sys@ORA10G> / NUM_OF_CONNS NUM_OF_SESSIONS ------------ --------------12 10 <-- after some time --> sys@ORA10G> / NUM_OF_CONNS NUM_OF_SESSIONS ------------ --------------0 0 This shows that the program had eight connections at the point I executed the query for the first time and 12 sessions. Ultimately, we had 12 sessions created on top of 12 connections. We can also see a stage where the number of sessions goes down to 10, while the number of connections open remains at 12. This experiment proves that each thread had a separate physical connection, in the case of multithreaded programs using OCI connection pooling. Generate Barcode In Java Using Barcode generator for Java Control to generate, create Barcode image in Java applications. www.OnBarcode.comEAN13 Generation In None Using Barcode maker for Software Control to generate, create EAN-13 Supplement 5 image in Software applications. www.OnBarcode.comSummary UCC.EAN - 128 Generation In Java Using Barcode creator for Java Control to generate, create EAN128 image in Java applications. www.OnBarcode.comBarcode Encoder In None Using Barcode printer for Excel Control to generate, create Barcode image in Microsoft Excel applications. www.OnBarcode.comIn this chapter, you learned the difference between connections and sessions in Oracle. You learned why connection pooling is necessary, and you distinguished between connection pooling and caching. You examined how Oracle9i implements the connection pooling framework and provides a sample connection caching implementation. As you saw, in Oracle 10g, the Oracle9i connection caching has been deprecated and replaced by the more powerful implicit connection caching. Finally, you took a look at how Oracle s OCI connection pooling improves scalability and performance by creating lightweight sessions on top of a low number of physical connections. Encoding EAN 128 In None Using Barcode drawer for Microsoft Excel Control to generate, create EAN / UCC - 14 image in Microsoft Excel applications. www.OnBarcode.comRecognize GS1 128 In Visual C#.NET Using Barcode recognizer for Visual Studio .NET Control to read, scan read, scan image in VS .NET applications. www.OnBarcode.comCode-128 Drawer In C# Using Barcode printer for Visual Studio .NET Control to generate, create Code 128C image in Visual Studio .NET applications. www.OnBarcode.comEncoding ANSI/AIM Code 39 In VB.NET Using Barcode generation for VS .NET Control to generate, create Code 39 Extended image in Visual Studio .NET applications. www.OnBarcode.comScan Data Matrix ECC200 In None Using Barcode recognizer for Software Control to read, scan read, scan image in Software applications. www.OnBarcode.comCode 39 Drawer In Java Using Barcode generator for Android Control to generate, create Code 3/9 image in Android applications. www.OnBarcode.com |
|