Обсуждение: Regarding facing lot of time Consumed by Socket.Poll()
Hi ,
In my project I use Nhibernate to connect to Postgres.
Currently it is very slow.
I have used Yourkit profiller to get some key informaitons.
In CPU profilling i have analyzed following things : -
Let me explain one by one : -
1- NHibernate.Impl.SessionImpl.DoLoad(Type, Object, Object, LockMode, Boolean)
Takes lots of time .
2- Internally it calls thse function i am listing the last stack
NpgsqlConnector.Open()
Npgsql.NpgsqlConnectedState.Startup(NpgsqlConnector)
Npgsql.NpgsqlState.ProcessBackendResponses(NpgsqlConnector)
[Wall Time] System.Net.Sockets.Socket.Poll(Int32, SelectMode)
Finally in last the socket.poll takes most of the time .
I want to know the probably causes of the socket.poll() consumes allot of time .
Please help me out to know the places why in DoLoad,DoLoadByClass and Socket.Poll is taking lot of time .
What are the scenario in which it might be getting slow down , Which i need to look .
--
Thanks,
Keshav Upadhyaya
In my project I use Nhibernate to connect to Postgres.
Currently it is very slow.
I have used Yourkit profiller to get some key informaitons.
In CPU profilling i have analyzed following things : -
Let me explain one by one : -
1- NHibernate.Impl.SessionImpl.DoLoad(Type, Object, Object, LockMode, Boolean)
Takes lots of time .
2- Internally it calls thse function i am listing the last stack
NpgsqlConnector.Open()
Npgsql.NpgsqlConnectedState.Startup(NpgsqlConnector)
Npgsql.NpgsqlState.ProcessBackendResponses(NpgsqlConnector)
[Wall Time] System.Net.Sockets.Socket.Poll(Int32, SelectMode)
Finally in last the socket.poll takes most of the time .
I want to know the probably causes of the socket.poll() consumes allot of time .
Please help me out to know the places why in DoLoad,DoLoadByClass and Socket.Poll is taking lot of time .
What are the scenario in which it might be getting slow down , Which i need to look .
--
Thanks,
Keshav Upadhyaya
Thanks Matthew for your quick reply .
Let me make my self more clear.
Suppose While doing one operation in my project, total time taken is 41 min .
in this 41 min around 35 min is takne by this call --
NHibernate.Impl.SessionImpl.DoLoad(Type, Object, Object, LockMode, Boolean)
and DoLoadbyClass().
And i believe internally these calls used System.Net.Sockets.Socket.Poll(Int32, SelectMode)
Which take most of the time not a bit* time .
And when i Use MSSQL no such kind of polling happens and it work in aound 2-3 mins .
So i believe Nhibernate config filles or some other configuration w.r.t. Postgres is not proper or improvement required.
Thanks,
keshav
--
Thanks,
Keshav Upadhyaya
Let me make my self more clear.
Suppose While doing one operation in my project, total time taken is 41 min .
in this 41 min around 35 min is takne by this call --
NHibernate.Impl.SessionImpl.DoLoad(Type, Object, Object, LockMode, Boolean)
and DoLoadbyClass().
And i believe internally these calls used System.Net.Sockets.Socket.Poll(Int32, SelectMode)
Which take most of the time not a bit* time .
And when i Use MSSQL no such kind of polling happens and it work in aound 2-3 mins .
So i believe Nhibernate config filles or some other configuration w.r.t. Postgres is not proper or improvement required.
Thanks,
keshav
On Thu, Oct 15, 2009 at 7:39 PM, Matthew Wakeling <mnw21@cam.ac.uk> wrote:
On Thu, 15 Oct 2009, keshav upadhyaya wrote:RTFM. Socket.Poll *waits* for a socket. Obviously it's going to spend quite a bit of time.[Wall Time] System.Net.Sockets.Socket.Poll(Int32, SelectMode)
Note that it is "wall time", not "CPU time".
You would be better investigating whatever is at the other end of the socket, which I presume is Postgres. Look at what the queries actually are, and try EXPLAIN ANALYSE on a few.
Matthew
--
It is better to keep your mouth closed and let people think you are a fool
than to open it and remove all doubt. -- Mark Twain
--
Thanks,
Keshav Upadhyaya
Hi heikki,
First of all a big thanks for your reply .
From server side query are not taking much time I have checked that .
But from the client side when i am executing Nhibernate.doload() , doloadbyclass() functions
it is taking much of the CPU time .
This i have analyzed by YOURKIT profiler for .Net applications .
Most of the CPU time is taken by Nhibernate.doload() , doloadbyclass() functions and i believe internally they are
calling System.Net.Sockets.Socket.Poll(Int32, SelectMode) function .
So my big worry is why Nhibernate.DoLoad() , DoLoadByClass is taking much of the time ?
Is there any Nhibernate related config file got changed ? or what are the most probale places for this problem so that i can look for them.
Apart from this i want to ask one more question .
In one machine it calls NPGSQLconnectorpool.GetNonpooledConnector()
and in other machien it callse NPGSQLconnectorpool.GepooledConnector()
Does calling pool and nonpool version of methods make a big difference ?
Thanks ,
Keshav
--
Thanks,
Keshav Upadhyaya
First of all a big thanks for your reply .
From server side query are not taking much time I have checked that .
But from the client side when i am executing Nhibernate.doload() , doloadbyclass() functions
it is taking much of the CPU time .
This i have analyzed by YOURKIT profiler for .Net applications .
Most of the CPU time is taken by Nhibernate.doload() , doloadbyclass() functions and i believe internally they are
calling System.Net.Sockets.Socket.Poll(Int32, SelectMode) function .
So my big worry is why Nhibernate.DoLoad() , DoLoadByClass is taking much of the time ?
Is there any Nhibernate related config file got changed ? or what are the most probale places for this problem so that i can look for them.
Apart from this i want to ask one more question .
In one machine it calls NPGSQLconnectorpool.GetNonpooledConnector()
and in other machien it callse NPGSQLconnectorpool.GepooledConnector()
Does calling pool and nonpool version of methods make a big difference ?
Thanks ,
Keshav
On Fri, Oct 16, 2009 at 2:20 AM, Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> wrote:
keshav upadhyaya wrote:I don't know much about Npgsql driver, but I'd guess that it's spending
> 2- Internally it calls thse function i am listing the last stack
>
> NpgsqlConnector.Open()
> Npgsql.NpgsqlConnectedState.Startup(NpgsqlConnector)
> Npgsql.NpgsqlState.ProcessBackendResponses(NpgsqlConnector)
> *[Wall Time] System.Net.Sockets.Socket.Poll(Int32, SelectMode)*
>
> Finally in last the socket.poll takes most of the time .
>
>
> I want to know the probably causes of the socket.poll() consumes allot of
> time .
a lot of time on Socket.Poll, because it's waiting for a response from
the server, sleeping. If you're investigating this because you feel that
queries are running too slowly, you should look at what the queries are
and investigate why they're slow in the server, e.g with EXPLAIN
ANALYZE. If you're investigating this because you're seeing high CPU
load in the client, try finding an option in the profiler to measure CPU
time, not Wall time.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
--
Thanks,
Keshav Upadhyaya
On Thu, 15 Oct 2009, keshav upadhyaya wrote: > [Wall Time] System.Net.Sockets.Socket.Poll(Int32, SelectMode) RTFM. Socket.Poll *waits* for a socket. Obviously it's going to spend quite a bit of time. Note that it is "wall time", not "CPU time". You would be better investigating whatever is at the other end of the socket, which I presume is Postgres. Look at what the queries actually are, and try EXPLAIN ANALYSE on a few. Matthew -- It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt. -- Mark Twain
keshav upadhyaya wrote: > 2- Internally it calls thse function i am listing the last stack > > NpgsqlConnector.Open() > Npgsql.NpgsqlConnectedState.Startup(NpgsqlConnector) > Npgsql.NpgsqlState.ProcessBackendResponses(NpgsqlConnector) > *[Wall Time] System.Net.Sockets.Socket.Poll(Int32, SelectMode)* > > Finally in last the socket.poll takes most of the time . > > > I want to know the probably causes of the socket.poll() consumes allot of > time . I don't know much about Npgsql driver, but I'd guess that it's spending a lot of time on Socket.Poll, because it's waiting for a response from the server, sleeping. If you're investigating this because you feel that queries are running too slowly, you should look at what the queries are and investigate why they're slow in the server, e.g with EXPLAIN ANALYZE. If you're investigating this because you're seeing high CPU load in the client, try finding an option in the profiler to measure CPU time, not Wall time. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
On Thu, Oct 15, 2009 at 10:02 AM, keshav upadhyaya <ukeshav2009@gmail.com> wrote: > Hi , > > In my project I use Nhibernate to connect to Postgres. > Currently it is very slow. > > I have used Yourkit profiller to get some key informaitons. > In CPU profilling i have analyzed following things : - > Let me explain one by one : - > > 1- NHibernate.Impl.SessionImpl.DoLoad(Type, Object, Object, LockMode, > Boolean) > > Takes lots of time . > > 2- Internally it calls thse function i am listing the last stack > > NpgsqlConnector.Open() > Npgsql.NpgsqlConnectedState.Startup(NpgsqlConnector) > Npgsql.NpgsqlState.ProcessBackendResponses(NpgsqlConnector) > [Wall Time] System.Net.Sockets.Socket.Poll(Int32, SelectMode) > > Finally in last the socket.poll takes most of the time . > > > I want to know the probably causes of the socket.poll() consumes allot of > time . > > Please help me out to know the places why in DoLoad,DoLoadByClass and > Socket.Poll is taking lot of time . > > What are the scenario in which it might be getting slow down , Which i need > to look . I'm not sure that you're going to get too much help with this one on this mailing list. It's not really a PostgreSQL question. You might try the npgsql guys... ...Robert