From: Eric Hodel Date: 2003-01-31T07:33:34+09:00 Subject: Re: drb experts --l0l+eSofNeLXHSnY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable ahoward (ahoward@fsl.noaa.gov) wrote: >=20 > drb'ing ruby'ists- >=20 > what is the preferred method of server a 'live' ruby object, eg one holdi= ng > resources on the local machine, like database connections >=20 > a) distribute the connections directly, perhaps starting a new DrbServer > (once only) for each connection - returning this object to the clients This will work well if you can load all the database drivers on the client end (once per client), and will perform the best because DRb is only dispatching database connections. > b) return a proxy object knowing it's Drb parent, where methods called o= n the > proxy relay into calls on the main Drb server This will result in the least memory overhead, but DRb may become a bottleneck if you have to do alot of database activity. Remember DRb spawns a thread per request. > obviously i know very little about drb - but hopefully the overall design= will > come through in my bad code. i'm hopefull that i'll be able to work out = the > details myself. i'm really interested in the best overall design stratag= y. Well, if you have only a few database requests, or have low memory, go with option b. If you have a ton of memory, or are doing many database queries, go with option a. If you're going to be using this with Apache, you'll be a tough call. Is the overhead of having the PG drivers in each Apache process worth it? Probably yes if you have a ton of memory or don't have many Apache processes hanging around. If you are low on memory, or only do a few DB queries/page, then you may be better off having DRb handle everything. --=20 Eric Hodel - drbrain@segment7.net - http://segment7.net All messages signed with fingerprint: FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --l0l+eSofNeLXHSnY Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (FreeBSD) iD8DBQE+Oag7MypVHHlsnwQRAotyAKCqcn+dVn8kcxfkXn4Fh85r2H8MuwCfapxJ MU3urb6kNpJ1Fi+Etikw6Wg= =a39h -----END PGP SIGNATURE----- --l0l+eSofNeLXHSnY--