, how to use smartthreadpool thread pool technology to achieve multi-tasking batch processing. (Highly recommended)
2, how to use. NET default ThreadPool thread pool technology to achieve multi-tasking batch processing.
3, how to use. NET 4.5 Asynchronous Programming task technology to achieve multi-tasking batch processing.
4.3. Basic use of third party open source components
1, log frame, Nlog and log4net.
2. Serialization of component Json.NET.
2. How to create a
arguments, which are passed to the function foo.Attention:Gevent.sleep (4) simulates an IO block that gevent can recognize,and Time.sleep (2) or other blocking, gevent is not directly recognized by the need to use the following line of code, patching, you can identify the1 #补丁2 from gevent import Monkey3 monkey.patch_all ()Must be placed in front of the patched person, such as before the Time,socket moduleOr we simply remember: To use gevent, you need to put the patch at the beginning of the fi
"open door State" WaitHandle.WaitAny (waithandle[] waithandles) //used to wait for any signal to become "open door State"Two. Thread pool:Each time the thread is created and the thread is destroyed, the CPU resources are consumed, so it can be optimized through the thread pool. The thread pool is a set of threads that have already been created, which are used to fetch, run out of threads, and then put in the thread pool for other people to useAn important method of the ThreadPool class:stat
worker objects is the number of threads in the thread pool, as to what needs to be recycled, above already said, is four kinds of situation;And finally, how did the thread pool get shut down?When it comes to the closure of the thread pool, it takes two methods, shutdown and Shutdownnow, all in Threadpoolexecutor, and for shutdown, he switches the thread pool state to shutdown, At this point, the tasks in the blocking queue are not affected, but the newly added tasks are rejected, while the idle
, default to yesrdbcompressionyes# Whether to add CRC64 checksum to the end of each file--take time to keep it safe rdbchecksumyes #磁盘上数据库的保存名称dbfilename dump.rdb# Redis working directory, the above database save file and aof log will be written to this directory dirc:/users/michael/desktop/file/work/data/redis/01/############## Synchronous ################# #主从复制 configured #slaveof 3. Start Redis Service Execute cmd command, enter, Redis install directory Execution:redis-server.exe redis01.con
Data | The database recently saw someone summarize the use of the connection pool on the forum, but unfortunately he just summed up Oracle and SQL Server. Now, I'm adding the IBM DB2 Connection pooling technology. For your reference! Tomcat configuration:
, although the address space is copied at write time, but need to replicate the parent process's page table (csapp-p584), the cost is large, threading can solve the problem of fork overhead, but the scheduler and memory problems still cannot be solved, so the thread pool, the number of threads fixed. Can solve the above problem. Because the TCP connection is a long connection, read reads will wait until the data is read, causing blocking, so it is set to non-blocking.2) thread pool implementatio
(String sql) throws SQLException { Connection conn = getConnection(); //通过某种方式获取数据库连接 PreparedStatement ps = null; int res = 0; try{ ps = conn.prepareStatement(sql); res = ps.executeUpdate(); }finally{ try{ ps.close(); }catch(Exception e){} try{ conn.close();// }catch(Exception e){} } return res; }
After using the database connection, the consumer typically calls the connection's method close directly to free the database resource, and if we use the connection
Spring uses annotations to configure C3P0 connection pooling and DAO use JdbcTemplate
1.Spring Configuration c3p0 Connection pool
Step one: Import the C3P0 jar package
Jar Package Download
Step Two: Create the spring configuration file and configure the connection pool
This is what we write when we write the C3P0 connection pool:
Combopooleddatasource datasource=new Combopooleddatasource ();
Datasource.setdriverclass ("Com.mysql.jdbc.
program.
The remainder of this article describes these two classes in detail, and finally gives an example demonstrating the general process by which the servlet uses connection pooling.
Second, the concrete realization
The list of Dbconnectionmanager.java procedures is as follows:
001 Import java.io.*;
002 Import java.sql.*;
003 Import java.util.*;
004 Import Java.util.Date;
005
006/**
007 * Management class Dbconnectionmanager support for one
And I personally think that the two are different:(1) A data source is a database-to-programming interface that corresponds to one database per data source.(2) The connection pool is just a buffer pool for the database connection object, which needs to be taken from the buffer pool when the data is connected.(3) The connection pool can manage the data source.Using TCP to connect your application with the database is an expensive thing (time consuming), and developers can use the connection pools
= "SA"Url= "JDBC:ODBC:BB"///Bridge data sourceMaxactive= "4"/>Add into the context file directly:Name= "Jdb/dbsource"Type= "Javax.sql.DataSource"Driverclassname= "Com.microsoft.jdbc.sqlserver.SQLServerDriver"Maxidle= "2"maxwait= "5000"Url= "Jdbc:microsoft:sqlserver://localhost:1433;databasename=jspdev"Maxactive= "4"/>Username= "he"Password= "he"Through the Java Jndi, you can do it.InitialContext initctx = new InitialContext ();DataSource ds = (DataSource) initctx.lookup ("java:comp/env/jdbc/data
Tags: mixed order mys div ASC same need here artOriginal: http://bbs.landingbj.com/t-0-243203-1.htmlIn some cases, MySQL can use an index to satisfy the ORDER BY clause without requiring additional sorting. The Where condition and order by use the same index, and the order by IS in the same sequence as the index, and the order by field is ascending or descending.For example, the following SQL can use an index.SELECT * from T1 ORDER by Key_part1,key_part2,...;SELECT * from T1 WHERE key_part1=1 OR
Use JMeter to test the performance of a database connection pool:
1. Download JMeter
2. servlet with no connection pool
Java code
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out .println(" out.println(" out.println(" out.println(" out.print(" This is "); out.print(this.getClass()); out.println(", using the GET method"); out.println("test
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.