Re: How DBA solved overload problem ?

2003-09-18 Thread Sean Chittenden
As a newly DBA, I really don't know how I deal with this
 problem. My problem is not so long ago, my database server seem to
 overloaded. It take me a time to find the cause of problem. I
 realize that some program don't queried wiht inappropriated SQL
 statement. I mean they're not efficient one.
 
 AS DBA how do you solved this problem?

In PostgreSQL, I flip on the following settings and then periodically
scan PostgreSQL's the log file (/var/log/pgsql):

log_duration = true
log_pid = true
log_statement = true
log_timestamp = true

It's tedious, but with grep on your side, it's not an impossible task
or even a super hard one... just a bit tedious if you don't keep up
with your developers.  I've found doing this on the devel machines
produces better bang for the buck than on the production DB's (though
I still do it there occasionally).  Once a query is found, I typically
launch a big 'ole fashion egrep -r with a reasonably unique part of
the query and am normally pretty successful in finding the culprit.
Sometimes you'll have to use sockstat to find what machine and what
PID you're dealing with, but that's something I have to do rarely.
-sc


PS Don't spam so many lists in the future, just -databases or just
-questions would've been sufficient (the more topical the list the
better).

-- 
Sean Chittenden
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Performance Problems.. Server hardware smoked by $500 box?

2003-09-11 Thread Sean Chittenden
  Post your kernel configs, or better yet, do a diff -u between the
  5.0-R and the 5.1-C kernel configs.  I bet dime to dollar you've
  got some debugging options enabled in the 5.1-C config.  At the
  very least you haven't remove the debugging options from your
  malloc options.
 
 *frown* The 5.0 development machine is running GENERIC. Being that
 we never customized the kernel, we don't have a backup copy of it. I
 can say since I'd have been the one to change it, that the only
 differences between GENERIC and what we put into service is that we
 always remove the device listings for things we don't have any use
 for, like ISA nic's and such. I almost never change any of the other
 features.

Removing unused drivers shouldn't make any difference.

 If 5.1-C has debugging on by default then , yes, I'd concur that we
 have those features turned on. However the production machine was
 4.8-R when we noticed the problem. From what it sounds, it should
 have been faster due to that fact. The only thing that's been
 constant in this situation is that the development machine hasn't
 changed. Everything I've done has been trying to change variables on
 the production machine to either match or surpass the development to
 bring it up to it's speed.

hrm...  On your development box, do you have any boot time
configuration options set, how about differing values in sysctl.conf?

Hrm, let me re-read your original post.

Apache: Are you sure you have your reverse DNS setup correctly?  Are
you doing host name resolution in Apache for your logs?  If
so, turn that off!

bonnie: It's very possible that the CPU is making a difference here if
bonnie is getting near 100% hit rates for the cache.  Given
that you're getting good throughput, I'd double check that
you're machines are at 100Mbps-TX, full duplex in ifconfig.  I
bet one of them is half-duplex and that's the difference
there.

I'm betting there are some sysctl's that are different between these
machines, along with possibly Apache and your DNS not being setup
correctly.

 Roadmap for the production machine so far:
 
 Upgrade apache/php to newest in ports.

I haven't seen anyone claim that Apache2 is faster than Apache 1.  If
Apache2 is faster, could someone provide some evidence?

 Add RAM

This won't make a difference unless you're swapping our out of RAM.

 Upgrade OS to 5.1 from 4.8, reinstall every package in pkg_info

Downgrade you mean?  :) 4.8 is going to be more battle proven than
5.1, so I'd recommend using 4.8 for that reason alone.  If you do want
to use 5.1 for the sake of helping 5.1 become more mature, very cool.

 Update apache to 2.X from 1.3.X  reinstall php as is required

See above comment on Apache.

 Swap network interfaces between the two onboard ones

This could make some difference, but 6MBps is more than plenty
throughput for webserving via NFS.

 Swap ethernet cables with the development machine

This would impact network performance, something else is going on.

 Swap ethernet ports with the development machine

Again, this would impact network performance, and at 6MBps, that's
well more than enough for you to get reasonable performance out of a
5.1 or 4.8 box.  Something basic and simple is going on here.

DNS:
dig my.test.box.example.com. a
dig d.c.b.a.in-addr.arpa. ptr

apache:

grep Hostname /usr/local/etc/apache/httpd.conf

-sc

-- 
Sean Chittenden
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


ipfilter per rule ttl's not working?

2003-08-26 Thread Sean Chittenden
Since ipf doesn't send keep alives to refresh its connections and on
our Intranet server that gets modest www traffic, how can I run with
reasonably low/sane TTLs for most of our rules, but have a different
TTL for ssh traffic?  The documentation suggests that I can do this:

   filter-rule = [ insert ] action in-out [ options ] [ tos ] [ ttl ]
  [ proto ] [ ip ] [ group ].
   ttl  = ttl decnumber .

But in practice, I think that the feature is unable to correctly
identify a valid number when it sees one.

From ipf.rules:

pass in quick on fxp1 ttl 604800 proto tcp from any to 192.168.1.0/24 port = 22 flags 
S keep state keep frags

# ipf -Fa -f /etc/ipf.rules
693: invalid ttl (604800)

:-/ One would think that 604800 would qualify as a decnumber.  Am I
missing something or is this a documented non-feature?

-sc

-- 
Sean Chittenden
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Disk cache size via sh?

2003-07-09 Thread Sean Chittenden
Is the following the correct way to figure out the disk cache size?

echo $((`sysctl -n vm.stats.vm.v_page_count` - \
 `sysctl -n vm.stats.vm.v_free_reserved` - \
 `sysctl -n vm.stats.vm.v_free_target`))

I can't tell if there's a limit in kern/vfs_cache.c though I couldn't
find anything worth while.
 
-sc
-- 
Sean Chittenden
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Disk cache size via sh?

2003-07-09 Thread Sean Chittenden
 Is the following the correct way to figure out the disk cache size?
 
 echo $((`sysctl -n vm.stats.vm.v_page_count` - \
  `sysctl -n vm.stats.vm.v_free_reserved` - \
  `sysctl -n vm.stats.vm.v_free_target`))
 
 I can't tell if there's a limit in kern/vfs_cache.c though I couldn't
 find anything worth while.

More correctly, can the FS cache up to the entire size listed in
vfs.maxbufspace (actually vfs.hibufspace) bytes or is there a limit to
how much FS operations can use of the vfs cache?  -sc

-- 
Sean Chittenden
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: gcc me harder: -Wconversion bug?

2003-06-10 Thread Sean Chittenden
 It seems to me that this is doing exactly what is claimed for -Wconversion.
 To quote from the gcc man page:
-Wconversion
   Warn  if  a prototype causes a type conversion that
   is different from what would happen to the same ar-
   gument  in  the  absence  of a prototype.  ...
 
 Now in the absence of a prototype for f() the argument true would be
 promoted from char/bool to int before being passed to the
 function. With the prototype in scope it is not promoted. Different
 argument widths so warning delivered.

% cpp test.c
# 1 test7.c
# 1 built-in
# 1 command line
# 1 test7.c
# 1 test7.h 1
# 13 test7.h
void f(char b);
# 2 test7.c 2

int
main(int argc, char *argv[]) {
  fchar)1)));

  return(0);
}

void
f(char b) {
}

Am I missing something that says that there isn't the prototype of the
same width?  Last time I checked my vision, f(char b) was the same as
f(char b)...  :-/ or am I missing something?  I believe that gcc's
promoting the char to an int or to some other non-1 byte width data
type... but I'm not seeing how, where, or why.  -sc

-- 
Sean Chittenden
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


gcc me harder: -Wconversion bug?

2003-06-09 Thread Sean Chittenden
[ Please CC: me on replies, not on questions@ ]

Is this a GCC bug with the -Wconversion flag or am I doing something
wrong?  I know it's just a warning, but it's irritating me more than
that dumb Dan Quayle quote, if it weren't for that horse, I wouldn't
have spent an extra year in college...  -sc

% gcc -v
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.2.2 [FreeBSD] 20030205 (release)
% uname -a
FreeBSD hostname.example.com 5.1-CURRENT FreeBSD 5.1-CURRENT #2: Mon Jun  9 12:23:34 
PDT 2003 [EMAIL PROTECTED]:/usr/src/sys/i386/compile/HOSTNAME  i386


% gcc -Wconversion test.c
test.c: In function `main':
test.c:5: warning: passing arg 1 of `f' with different width due to prototype

/* Begin test.h */
#ifndef __TEST_H__
#define __TEST_H__

#ifndef bool
typedef char bool;
#endif

#ifndef true
#define true((bool)1)
#endif

#ifndef false
#define false   ((bool)0)
#endif

void f(bool b);
#endif
/* End test.h */


/* Begin test.c */
#include test.h

int
main(void) {
  f(true);
  return(0);
}

void
f(bool b) { }
/* End test.c */

-- 
Sean Chittenden
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Number of sf_bufs (nsfbuf)'s available/inuse for -STABLE...

2003-03-03 Thread Sean Chittenden
Is there any way to determine if there are any sf_buf's available or
how many are in use under -STABLE?  I know -CURRENT has
kern.ipc.nsfbufs as a read only tunable, but that doesn't tell me how
many are free.  Anyone else use sendfile(2) extensively and have
pearls of wisdom in terms of performance tuning?  -sc

-- 
Sean Chittenden


pgp0.pgp
Description: PGP signature