We are currently in the process of migrating data from SQLServer to PostgreSQL Databases and we have a problem:
We attach the pgbench test:pgbench emp_bra_lctr -C- c 700- j 50 - T 60 -U postgres
starting vacuum ... end .
transaction type: TPC- B ( sort of)
scaling factor : 1
query mode: single
number of clients: 700
number of threads: 50
duration: 60 s
number of transactions actually processed : 8673
tps = 135.914877 (including connections Establishing )
tps = 138.361335 (excluding connections Establishing )
Very happy for your quick response. First of all, thank you and your development team the great work done with this connector.
Read more about our data access layer and on our servers:
Our application :- It's divided into 2 layers of access , the first containing a Helper hits on PostgreSQL, SQLServer , MySQL , ODBC ... the second is a layer representing each of the tables in our database .
- I have attachado our DataHelper and a class of data access layer as an example.
- Right now we are testing the Npgsql version 2.1RC.
DataHelper:
- ADataBase: abstract class that contains all the functionality of access.
. ExecureReader
. ExecuteQuery
. ExecuteScalar
. ExecuteNonQuery
- MySqlDataBase , PostgreSQLDataBase , SqlServerDataBase: contains Connections, DataAdapters , DataCommands and DataParameters , system specific for each database connection
- DataParameter : Generic dataParameter for DataHelper.
Data layer specifies:
- An example of it is that I send in class "Candidate_Stack_Test", which is one of our tables and complies with this:- We use an architecture of 5 methods to access to the database:
Read - do a select by primary key.
Update - modify an entire row by primary key
Insert - Inserts a row
List - select a rows filtering by a filter and a pagination, and return the number of registers total that complaint this filter. The connection of this function is made as a transaction (READUNCOMMITTED), returning two refcursors.
Count - return the number of registers total that complaint the filter
Our server:- PostgreSQL 9.3 installed
Answering your questions:Which errors are you getting? Are you receiving "connection timeout" problems or the system simply starts to fail to respond everything?- Timeout errors are usually because the database can not be removed fast enough queries, but contrary to what it may seem, the timeout are completely random, occurs in queries easy to resolve.
Some examples:
some examples:
" System.Exception : Timeout while getting a connection from pool .
at Npgsql.NpgsqlConnectorPool.RequestConnector ( NpgsqlConnection Connection)
at Npgsql.NpgsqlConnection.Open ( )
at IFCustomData.Data.ADataBase.ExecuteQuery ( IsolationLevel pTransactio (...) ...
System.Exception : Connector Message - DIC_Profile_Lst - : Timeout while getting a connection from pool . - Failed to perform an operation against the database ---> System.Exception : Timeout while getting a connection from pool .
Npgsql.NpgsqlConne at ( ... )
"
" System.Exception :
Message Connector - Candidate_Stack_Test_Lst - :
ERROR : 57014 : canceling statement due to statement timeout - Error when performing an operation against the database
---> Npgsql.NpgsqlException : ERROR : 57014 : canceling statement due to st ( ... ) "
" System.Exception :
Message Connector - Candidate_Stack_Test_Lst - :
ERROR : 57014 : canceling statement due to statement timeout - Error when performing an operation against the database
---> Npgsql.NpgsqlException : ERROR : 57014 : canceling statement due to st ( ... ) "
" System.Exception :
Message Connector - Candidate_Stack_Test_Lst - :
A timeout has occured . If you were Establishing a connection , Increase Timeout value in ConnectionString .
If you were executing a command , Increase the CommandTimeout value in ConnectionStr ( ... ) "
Which postgresql version are you using? 9.3?
PostgreSQL 9.3
In your architecture, are you open a new connection for each requisition?If we use the pattern of opening and closing connection on each call , as you will see in the classes that I send you.Regarding connection pool, we received a patch which I'm reviewing that adds some scalability improvements. This may be related to your problem with many connections.We could try this patch too.Just this Wednesday 19th applied this patch on the Npgsql version 2.1RC
We do a load test at "REAL" environment and worked better, but still does not seem good enough.
Anyway this coming Monday we planning at REAL environment to all our applications already include Npgsql 2.1RC version with fix 178 and 182, to check "in- situ" with what we already have migrated to PostgreSQL if managed load better .
What is the value of MaxPoolSize you are using in Npgsql connection string?The value of MaxPoolSize is that you have the default ( 20).
An example connectionString :
<add name="DataBase.PostgreSql.Wrt" connectionString="Server=brapostgressqldev01.infobras.corp;Port=5432;Database=emp_bra;User Id=postgres;"/>
A good value for us could be ( 100)?
Not sure if it is for the following reasons:- How to use the queries through database functions. Especially the "_Lst" together with the Npgsql.
- ConnectionString setup for PostgreSQL.
- Or that the connector Npgsql is less effective under certain conditions.
Thank you very much!
We are also reviewing our side. If we see something of interest I will communicate to you.
--To view this discussion on the web visit https://groups.google.com/d/msgid/npgsql-help/f3d1ba73-7dfe-4d36-b833-b9d0e8264b85%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Npgsql Help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to npgsql-help...@googlegroups.com.
Sorry I have not contacted you so far, but we have been busy.
First, thank you for the interest and rapid response through the release of the new version.
We are currently using version 2.1 with the following patches (# 178 and # 182 ), seems to work properly.
Our performance problems seem solved at the end.
I think eventually our problems had different origins.
Ignorance of this new database system , which stemmed in:
- A poor server configuration.
- Some queries not behaved the same way in "SqlServer" and "PostgreSQL", especially by the different management of Index between "SqlServer" and "PostgreSQL".
- And finally it seems that the recursion in the "ConnectionPool" makes a strong claim to the "Pool" is saturated and reject new connections, with Patches (# 178 and # 182 ) runs much better under strong demand and no longer rejects connections.
I have a seemingly simple question to answer.
I have seen that you have only initiate transactions available the following methods ( REPEATABLE READ, SERIALIZABLE , READ COMMITTED ), with READ COMMITTED the default choice .
I've also added the following method (READ UNCOMMITTED) and works well with PostgreSQL version 9.3.
It's as simple as this:
else if ( == isolation System.Data.IsolationLevel.ReadUncommitted )
{
commandText.Append ( "READ UNCOMMITTED ");
}
else
{
/ / Set default isolation level to read committed .
_isolation = IsolationLevel.ReadCommitted ;
commandText.Append ( "READ COMMITTED ");
}
In the constructor.
That is something in particular?
Having only these 3 methods of isolation? Is it a compatibility issue with earlier versions of postgreSQL?
Regards,
Hi,Sorry I have not contacted you so far, but we have been busy.
First, thank you for the interest and rapid response through the release of the new version.
We are currently using version 2.1 with the following patches (# 178 and # 182 ), seems to work properly.
Our performance problems seem solved at the end.
I think eventually our problems had different origins.
Ignorance of this new database system , which stemmed in:
- A poor server configuration.
- Some queries not behaved the same way in "SqlServer" and "PostgreSQL", especially by the different management of Index between "SqlServer" and "PostgreSQL".
- And finally it seems that the recursion in the "ConnectionPool" makes a strong claim to the "Pool" is saturated and reject new connections, with Patches (# 178 and # 182 ) runs much better under strong demand and no longer rejects connections.
I have a seemingly simple question to answer.
I have seen that you have only initiate transactions available the following methods ( REPEATABLE READ, SERIALIZABLE , READ COMMITTED ), with READ COMMITTED the default choice .
I've also added the following method (READ UNCOMMITTED) and works well with PostgreSQL version 9.3.
It's as simple as this:
else if ( == isolation System.Data.IsolationLevel.ReadUncommitted )
{
commandText.Append ( "READ UNCOMMITTED ");
}
else
{
/ / Set default isolation level to read committed .
_isolation = IsolationLevel.ReadCommitted ;
commandText.Append ( "READ COMMITTED ");
}
In the constructor.That is something in particular?
Having only these 3 methods of isolation? Is it a compatibility issue with earlier versions of postgreSQL?
Regards,