[OpenSIPS-Users] siptrace insert into db
Josip Djuricic
josip.djuricic at voljatel.hr
Mon Feb 8 12:41:25 CET 2010
Hi,
> What kind of changes do you have in mind?
I want to add mysql compress function for msg field.
I've tried it now with:
char *spoji = "compress('";
char *spojikraj = "')";
char *str_final;
str_final = (char *)malloc((strlen(spoji) + strlen(msg->buf) +
strlen(spojikraj) + 1) *sizeof(char));
strcpy(str_final, spoji);
strcat(str_final, msg->buf);
strcat(str_final, spojikraj);
db_vals[0].val.blob_val.s = str_final;
db_vals[0].val.blob_val.len = strlen(str_final);
free(str_final);
I know it's ugly, but it was just for testing to see if it works, but for
some reason mysql don't know to uncompress this blob field (it returns NULL
always, no matter that length and uncopressed_length returns values).
> Can you give some ratio about the differente (in space) between char and
> varchar (for siptrace) ?
It all depends on users environments, and field lengths, in my env (if
calculated correctly) changing chars to varchars and compressing msg field
it would mean around 45% less disk space usage...since we have 8-10G of logs
per day that is hug saving, it would allow us to hold almost twice as long
sip traces for debugging purposes.
Also I have one other question regarding siptrace. I've noticed if it loses
connectivity to mysql opensips stops processing messages. Perhaps a better
approach would be to start new thread for mysql writing, and having siptrace
queue that fills, so when thread has nothing to do it takes one record from
pool, and so on and on, but in case it looses connectivity it would fill the
queue (until some limit) but it wouldn't affect message processing? Or at
least implement if there is insert error because of mysql connectivity issue
to disable siptrace until manually started again.
Best regards,
Josip
-----Original Message-----
From: users-bounces at lists.opensips.org
[mailto:users-bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei Iancu
Sent: Monday, February 08, 2010 12:00 PM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] siptrace insert into db
Hi Josip,
Josip Djuricic wrote:
> Hi,
>
> simple and quick question, is there an easy way to change insert query
> for opensips 1.6 siptrace module?
>
What kind of changes do you have in mind?
> I want to add mysql compress function on msg field.
>
Hmm...this is not about the siptrace module, but the db_mysql module, I
would say....
> Also I would advice changing char values to varchar values because on
> heavy load machines there could be very big difference between char(255)
> and varchar(255) fields in terms of disk space.
>
Originally we had the varchar(), but due performance reasons, we
switched to char().....so here we are in the eternal dilemma "speed
versus diskspace" :)...
Can you give some ratio about the differente (in space) between char and
varchar (for siptrace) ?
Thanks and regards,
Bogdan
> Best regards,
>
> Josip
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
--
Bogdan-Andrei Iancu
www.voice-system.ro
_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
More information about the Users
mailing list