Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 04-19-2008, 06:27 AM
Robert Treat
 
Posts: n/a
Default Re: Expose checkpoint start/finish times into SQL.

On Thursday 03 April 2008 19:08, Andrew Dunstan wrote:
> Joshua D. Drake wrote:
> >> Theo Schlossnagle wrote:
> >>> First whack at exposing the start and finish checkpoint times into
> >>> SQL.
> >>
> >> Why is that useful?

> >
> > For knowing how long checkpoints are taking. If they are taking too
> > long you may need to adjust your bgwriter settings, and it is a
> > serious drag to parse postgresql logs for this info.

>
> Even if this were true, surely the answer is to improve the logging.
>


Exposing everything into the log files isn't always sufficient (says the guy
who maintains a remote admin tool)

--
Robert Treat
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 04-19-2008, 06:27 AM
Andrew Dunstan
 
Posts: n/a
Default Re: Expose checkpoint start/finish times into SQL.



Robert Treat wrote:
> On Thursday 03 April 2008 19:08, Andrew Dunstan wrote:
>
>> Joshua D. Drake wrote:
>>
>>>> Theo Schlossnagle wrote:
>>>>
>>>>> First whack at exposing the start and finish checkpoint times into
>>>>> SQL.
>>>>>
>>>> Why is that useful?
>>>>
>>> For knowing how long checkpoints are taking. If they are taking too
>>> long you may need to adjust your bgwriter settings, and it is a
>>> serious drag to parse postgresql logs for this info.
>>>

>> Even if this were true, surely the answer is to improve the logging.
>>
>>

>
> Exposing everything into the log files isn't always sufficient (says the guy
> who maintains a remote admin tool)
>


It should be now that you can have machine readable logs (says the guy
who literally spent weeks making that happen) ;-)

cheers

andrew

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 04-19-2008, 06:27 AM
Andrew Dunstan
 
Posts: n/a
Default Re: Expose checkpoint start/finish times into SQL.



Theo Schlossnagle wrote:
>
>>
>>
>> Has this feature been discussed on -hackers? I don't recall it (and
>> my memory has plenty of holes in it), but I'm sure that after
>> attending my talk last Sunday Theo hasn't sent in a patch for an
>> undiscussed feature ;-)

>
>
> Andrew: I don't think this feature has been discussed on hackers. The
> patch took about 15 minutes to author, so it sounds like the most
> concise way to start a conversation. Seems silly to start the
> conversation on hackers with a patch. :-)
>
>


Well, not really. I believe -hackers has a much larger readership than
-patches, so even for small features we generally want them discussed
there.

cheers

andrew

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 04-19-2008, 06:27 AM
Robert Treat
 
Posts: n/a
Default Re: Expose checkpoint start/finish times into SQL.

On Thursday 03 April 2008 21:14, Joshua D. Drake wrote:
> On Thu, 03 Apr 2008 20:29:18 -0400
>
> Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > "Joshua D. Drake" <jd@commandprompt.com> writes:
> > > Heikki Linnakangas <heikki@enterprisedb.com> wrote:
> > >> Why is that useful?
> > >
> > > For knowing how long checkpoints are taking. If they are taking too
> > > long you may need to adjust your bgwriter settings, and it is a
> > > serious drag to parse postgresql logs for this info.

> >
> > 1. To do anything useful along those lines, you would need to look at
> > a lot of checkpoints over time, which is what log_checkpoints is good
> > for. This patch only tells you about the latest, which isn't very
> > useful for making any good decisions about parameters.

>
> I would agree with this. We would need a history of checkpoints that
> didn't reset until we told it to.
>


You can plug a single item graphed over time into things like rrdtool to get
good trending information. And it's often easier to do this using sql
interfaces to get the data than pulling it out of log files (almost like the
db was designed for that :-)

> > 2. If I read the patch correctly, half of the time what you'd be
> > seeing is the start time of the currently-active checkpoint and the
> > completion time of the prior checkpoint. I don't know what those
> > numbers are good for at all.

>


Knowing when the last checkpoint occured is certainly useful for monitoring
purposes (wrt pitr and as a general item for cuasing alerts if checkpoints
stop occuring frequently enough, or if they start taking too long.)

>
> > 3. As of PG 8.3, the bgwriter tries very hard to make the elapsed time
> > of a checkpoint be just about checkpoint_timeout *
> > checkpoint_completion_target, regardless of load factors. So unless
> > your settings are completely broken, measuring the actual time isn't
> > going to tell you much.

>


How does one measure when the bgwriter is failing at this effort?

--
Robert Treat
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 04-19-2008, 06:27 AM
Tom Lane
 
Posts: n/a
Default Re: Expose checkpoint start/finish times into SQL.

Robert Treat <xzilla@users.sourceforge.net> writes:
>> Tom Lane <tgl@sss.pgh.pa.us> wrote:

> 3. As of PG 8.3, the bgwriter tries very hard to make the elapsed time
> of a checkpoint be just about checkpoint_timeout *
> checkpoint_completion_target, regardless of load factors. So unless
> your settings are completely broken, measuring the actual time isn't
> going to tell you much.


> How does one measure when the bgwriter is failing at this effort?


Well, not with *this* patch. At least not without adding a lot of
infrastructure on top of it, and I'm failing to see why you'd build
such infrastructure in order to track just two numbers that are of
uncertain value.

JD seems to be on record that the existing logging mechanism sucks
and he needs something else. That's fine, but I think it means that
we need to improve logging in general, not invent a single-purpose
mechanism for logging checkpoint times.

Theo claimed he had a reason for wanting to know the latest checkpoint
time, *without* any intention of time-extended tracking of that; but
he didn't say what it was. If there is a credible reason for that
then it might justify a patch of this nature, but I don't see that
the reasons that have been stated so far in the thread hold any water.

regards, tom lane

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 04-19-2008, 06:27 AM
Theo Schlossnagle
 
Posts: n/a
Default Re: Expose checkpoint start/finish times into SQL.


On Apr 3, 2008, at 10:33 PM, Tom Lane wrote:
> Theo claimed he had a reason for wanting to know the latest checkpoint
> time, *without* any intention of time-extended tracking of that; but
> he didn't say what it was. If there is a credible reason for that
> then it might justify a patch of this nature, but I don't see that
> the reasons that have been stated so far in the thread hold any water.



We had a recent event where the system stopped checkpointing, which
eventually lead to Robert Treat's therapy session at PostgreSQL
Conference East. If you have been good to be able to remotely (via
SQL) monitor the system to ensure that the last checkpoint start time
is within a reasonable window from current_timestamp.

My patch was clearly single purposed and never intended to be a SQL
accessible log of checkpoint times.

So, in reality, the "finish time" of the checkpoint is really not of
any importance to me either.

--
Theo Schlossnagle
Esoteric Curio -- http://lethargy.org/
OmniTI Computer Consulting, Inc. -- http://omniti.com/


--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 04-19-2008, 06:27 AM
Tom Lane
 
Posts: n/a
Default Re: Expose checkpoint start/finish times into SQL.

Theo Schlossnagle <jesus@omniti.com> writes:
> On Apr 3, 2008, at 10:33 PM, Tom Lane wrote:
>> Theo claimed he had a reason for wanting to know the latest checkpoint
>> time, *without* any intention of time-extended tracking of that; but
>> he didn't say what it was.


> We had a recent event where the system stopped checkpointing, which
> eventually lead to Robert Treat's therapy session at PostgreSQL
> Conference East.


Therapy is great ;-) ... but "the system stopped checkpointing" does not
strike me as a routine occurrence that we should be making provisions
for DBAs to watch for. What, pray tell, is the DBA supposed to do when
and if he notices that? Not to mention that since checkpointing is
ingrained in the bgwriter, you've got worse problems than that if it's
not working.

I'd much rather be spending our time and effort on understanding what
broke for you, and fixing the code so it doesn't happen again. An ounce
of prevention is worth a pound of cure, and all that...

regards, tom lane

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 04-19-2008, 06:27 AM
Greg Smith
 
Posts: n/a
Default Re: Expose checkpoint start/finish times into SQL.

On Thu, 3 Apr 2008, Robert Treat wrote:

> You can plug a single item graphed over time into things like rrdtool to
> get good trending information. And it's often easier to do this using
> sql interfaces to get the data than pulling it out of log files (almost
> like the db was designed for that :-)


The pg_stat_bgwriter value for buffers_checkpoint was intentionally
implemented in 8.3 such that it jumps in one big lump when the checkpoint
is done. While it's not the ideal interface for what you're looking for,
the reason for that is to made it possible to build a "when was the last
checkpoint finished?" interface via some remote monitoring tool just by
determining the last time that the value jumped upwards. You can easily
see them just by graphing that value, it shouldn't be too hard to teach
something with rrdtool guts to find them.

Since checkpoints have a fairly predictable duration in 8.3, as long as
you catch the start or end of them you can make a resonable guess where
the other side was. The case you're trying to avoid here, the system
going a long time without checkpointing, can be implemented by looking for
a begin or end regularly, you don't need to track both. As long as
there's a checkpoint finish "pulse" in buffers_checkpoint showing up
regularly you're fine. The only situation I can think of where this might
be problematic is where the system has been idle enough to not have any
buffers to write at checkpoint time, but I recall a code path there where
checkpoints stop altogether unless there's been activity so even tracking
the time may not change that.

Ultimately a lot of the other questions you might ask (i.e. "how many
buffers have been written per hour by checkpoints?") require processing
the numbers in this way anyway, and I thought this implementation was good
enough to monitor the situation you're trying to avoid--presuming you're
using some sort of moderately powerful remote monitoring tool. Theo's
patch would make it easier to answer with a simple command which has some
value; a little SQL in a cron job would be good enough to trigger an alert
rather than needing a real monitoring probe.

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #19 (permalink)  
Old 04-19-2008, 06:27 AM
Bruce Momjian
 
Posts: n/a
Default Re: Expose checkpoint start/finish times into SQL.

Greg Smith wrote:
> On Thu, 3 Apr 2008, Robert Treat wrote:
>
> > You can plug a single item graphed over time into things like rrdtool to
> > get good trending information. And it's often easier to do this using
> > sql interfaces to get the data than pulling it out of log files (almost
> > like the db was designed for that :-)

>
> The pg_stat_bgwriter value for buffers_checkpoint was intentionally
> implemented in 8.3 such that it jumps in one big lump when the checkpoint
> is done. While it's not the ideal interface for what you're looking for,
> the reason for that is to made it possible to build a "when was the last
> checkpoint finished?" interface via some remote monitoring tool just by
> determining the last time that the value jumped upwards. You can easily
> see them just by graphing that value, it shouldn't be too hard to teach
> something with rrdtool guts to find them.
>
> Since checkpoints have a fairly predictable duration in 8.3, as long as
> you catch the start or end of them you can make a resonable guess where
> the other side was. The case you're trying to avoid here, the system
> going a long time without checkpointing, can be implemented by looking for
> a begin or end regularly, you don't need to track both. As long as
> there's a checkpoint finish "pulse" in buffers_checkpoint showing up
> regularly you're fine. The only situation I can think of where this might
> be problematic is where the system has been idle enough to not have any
> buffers to write at checkpoint time, but I recall a code path there where
> checkpoints stop altogether unless there's been activity so even tracking
> the time may not change that.


If we want to expose more of the internals of Postgres via functions,
fine, but a one-off function just to cover something that happened to
one user just doesn't make sense. We need a plan on exactly what we
want to expose in a coherent way, and how.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #20 (permalink)  
Old 04-19-2008, 06:27 AM
Greg Smith
 
Posts: n/a
Default Re: Expose checkpoint start/finish times into SQL.

On Thu, 3 Apr 2008, Tom Lane wrote:

> "the system stopped checkpointing" does not strike me as a routine
> occurrence that we should be making provisions for DBAs to watch for.
> What, pray tell, is the DBA supposed to do when and if he notices that?


Schedule downtime rather than wait for it to happen unpredictably when the
inevitable crash happens.

> I'd much rather be spending our time and effort on understanding what
> broke for you, and fixing the code so it doesn't happen again.


(Here I start laughing all over again as I recall Robert's talk, which we
really need to get you in particular the video of) Their situation had
possible causes that included a bit flipping in bad memory, which is
pretty hard to code around (unless you're a Core Wars veteran). I'm
familiar with that part of the checkpoint code path, and everything I was
able to think of when hearing the outline of events was already considered
and rejected as not being a likely cause. This patch comes out of
pragmatic acceptance that, sometimes, stuff will happen you can't easily
explain, but that doesn't mean it's not worth keeping an eye on it anyway
so it doesn't sneak up on you again.

Anyway, I think this whole thing would be better handled by a larger
internals view that this whole codebase could use a dose of anyway. What
I really want is an interface like this:

psql> select pg_internals('last_checkpoint_time');

and then start sprinkling exports of those probe points in some popular
places people would like to look at.

I will apologize now for suggesting this, followed by not having enough
time to code it in the near future.

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:25 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
UnixAdminTalk.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476