[Firebird-devel] Trace touchThread waking too early
Hello All, A few days ago I posted on Firebird Support "Firebird Recurring Hourly Load". The gist of the post is that we noticed that every hour all Firebird processes would wake up for a second or two causing high load, context switches etc - This using Firebird 2.5.x on Centos 6.x/7.x. I've look into this a little bit more and notice that the issue seems to lie in the trace touch thread - specifically TouchThreadFunc in jrd/trace/TraceConfigStorage.cpp. (Please note that I'm not a c++ developer, so there's a good chance that I'm missing something) Each thread calls sem_timedwait [while (!semaphore->tryEnter(delay))] with the next touch time in seconds. The thread then blocks till seconds after epoch + current milliseconds. When it returns it compares to the touch time: if (!m_base->touch_time || m_base->touch_time < now) Since touch_time is an integer value, current seconds will be equal to it for up to a full second. This results in a delay of zero being calculated and sem_trywait being called repeatedly for up to a second per thread until current seconds > touch_time. To resolve shouldn't the comparison check for equality: if (!m_base->touch_time || m_base->touch_time <= now) I'm also curious as to why each thread is required to wake at the exact same time - would it not reduce contention if each thread blocked for a full hour? Finally, for my own curiosity, what is the reason for touching the trace file hourly? I look forward to hearing your thoughts. Thanks and regards, David -- Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
[Firebird-devel] [FB-Tracker] Created: (CORE-5401) High load in touch thread
High load in touch thread - Key: CORE-5401 URL: http://tracker.firebirdsql.org/browse/CORE-5401 Project: Firebird Core Issue Type: Bug Affects Versions: 2.5.6 Reporter: Alexander Peshkov A few days ago I posted on Firebird Support "Firebird Recurring Hourly Load". The gist of the post is that we noticed that every hour all Firebird processes would wake up for a second or two causing high load, context switches etc - This using Firebird 2.5.x on Centos 6.x/7.x. I've look into this a little bit more and notice that the issue seems to lie in the trace touch thread - specifically TouchThreadFunc in jrd/trace/TraceConfigStorage.cpp. (Please note that I'm not a c++ developer, so there's a good chance that I'm missing something) Each thread calls sem_timedwait [while (!semaphore->tryEnter(delay))] with the next touch time in seconds. The thread then blocks till seconds after epoch + current milliseconds. When it returns it compares to the touch time: if (!m_base->touch_time || m_base->touch_time < now) Since touch_time is an integer value, current seconds will be equal to it for up to a full second. This results in a delay of zero being calculated and sem_trywait being called repeatedly for up to a second per thread until current seconds > touch_time. To resolve shouldn't the comparison check for equality: if (!m_base->touch_time || m_base->touch_time <= now) I'm also curious as to why each thread is required to wake at the exact same time - would it not reduce contention if each thread blocked for a full hour? Finally, for my own curiosity, what is the reason for touching the trace file hourly? -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira -- Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Re: [Firebird-devel] Trace touchThread waking too early
On 11/18/16 14:19, David Hollings wrote: > Hello All, > > A few days ago I posted on Firebird Support "Firebird Recurring Hourly > Load". > The gist of the post is that we noticed that every hour all Firebird > processes would wake up for a second or two causing high load, context > switches etc - This using Firebird 2.5.x on Centos 6.x/7.x. > > I've look into this a little bit more and notice that the issue seems to lie > in the trace touch thread - specifically TouchThreadFunc in > jrd/trace/TraceConfigStorage.cpp. > (Please note that I'm not a c++ developer, so there's a good chance that I'm > missing something) > > Each thread calls sem_timedwait [while (!semaphore->tryEnter(delay))] with > the next touch time in seconds. The thread then blocks till seconds after > epoch + current milliseconds. > When it returns it compares to the touch time: > > if (!m_base->touch_time || m_base->touch_time < now) > > Since touch_time is an integer value, current seconds will be equal to it > for up to a full second. This results in a delay of zero being calculated > and sem_trywait being called repeatedly for up to a second per thread until > current seconds > touch_time. > > > To resolve shouldn't the comparison check for equality: > > if (!m_base->touch_time || m_base->touch_time <= now) Your analysis and way to cure he bug are absolutely correct, thank you. > I'm also curious as to why each thread is required to wake at the exact same > time - would it not reduce contention if each thread blocked for a full > hour? That's how it's dome in FB3 and future versions. > Finally, for my own curiosity, what is the reason for touching the trace > file hourly? Very simple - need to coexist with cron's scripts performing housekeeping in /tmp. For details see http://tracker.firebirdsql.org/browse/CORE-2917 -- Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Re: [Firebird-devel] [FirebirdSQL/firebird] 5aede1: Decimal floating point numbers - first draft
Please, anybody subscribed to this list with gmail is seeing Alex Peshkoff messages? Adriano On 13/11/2016 20:12, Adriano dos Santos Fernandes wrote: > FYI, previous problem with all Alex messages coming to my gmail spam > folder I resolved putting his contact in a "white list". > > But now messages from Alex (even the github commits) does not enter in > my mail box even in spam folder. > > > Adriano > > -- > Developer Access Program for Intel Xeon Phi Processors > Access to Intel Xeon Phi processor-based developer platforms. > With one year of Intel Parallel Studio XE. > Training and support from Colfax. > Order your platform today. http://sdm.link/xeonphi > Firebird-Devel mailing list, web interface at > https://lists.sourceforge.net/lists/listinfo/firebird-devel -- Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Re: [Firebird-devel] [FirebirdSQL/firebird] 5aede1: Decimal floating point numbers - first draft
No -Original Message- From: Adriano dos Santos Fernandes [mailto:adrian...@gmail.com] Sent: Friday, November 18, 2016 7:59 PM To: For discussion among Firebird Developers Subject: Re: [Firebird-devel] [FirebirdSQL/firebird] 5aede1: Decimal floating point numbers - first draft Please, anybody subscribed to this list with gmail is seeing Alex Peshkoff messages? Adriano On 13/11/2016 20:12, Adriano dos Santos Fernandes wrote: > FYI, previous problem with all Alex messages coming to my gmail spam > folder I resolved putting his contact in a "white list". > > But now messages from Alex (even the github commits) does not enter in > my mail box even in spam folder. > > > Adriano > > -- > Developer Access Program for Intel Xeon Phi Processors Access > to Intel Xeon Phi processor-based developer platforms. > With one year of Intel Parallel Studio XE. > Training and support from Colfax. > Order your platform today. http://sdm.link/xeonphi Firebird-Devel > mailing list, web interface at > https://lists.sourceforge.net/lists/listinfo/firebird-devel -- Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel -- Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel