[FC] some speedup for MAC Track

Support questions about the MAC Track plugin

Moderators: Developers, Moderators

Post Reply
User avatar
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

[FC] some speedup for MAC Track

Post by gthe »

Sorry for my English...

In my mysql_slowquery.log I see constant records:

Code: Select all

# Time: 080117 10:48:06
# User@Host: cactiuser[cactiuser] @ localhost []
# Query_time: 80  Lock_time: 0  Rows_sent: 0  Rows_examined: 1532615
REPLACE INTO mac_track_scan_dates (SELECT DISTINCT scan_date from mac_track_ports);
The reason of their occurrence:

Code: Select all

mysql> SELECT DISTINCT scan_date from mac_track_ports;
+---------------------+
| scan_date           |
+---------------------+
| 2008-01-29 01:13:07 |
| 2008-01-29 01:22:27 |
| 2008-01-29 01:34:54 |
| 2008-01-29 01:43:33 |
| 2008-01-29 01:52:28 |
| 2008-01-29 02:07:40 |
| 2008-01-29 02:14:47 |
............................................
| 2008-02-12 18:06:39 |
+---------------------+
1738 rows in set (25.60 sec)
For optimization I have made:

Code: Select all

ALTER TABLE `mac_track_ports` ADD INDEX `scan_date` USING BTREE(`scan_date`);
And after that my results:

Code: Select all

mysql> SELECT DISTINCT scan_date from mac_track_ports;
+---------------------+
| scan_date           |
+---------------------+
| 2008-01-29 01:13:07 |
| 2008-01-29 01:22:27 |
| 2008-01-29 01:34:54 |
| 2008-01-29 01:43:33 |
| 2008-01-29 01:52:28 |
.......................................
| 2008-02-12 17:53:10 |
| 2008-02-12 18:06:39 |
| 2008-02-12 18:17:09 |
+---------------------+
1739 rows in set (0.01 sec)
From 25 to 0.01 sec!!
User avatar
streaker69
Cacti Pro User
Posts: 712
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

Post by streaker69 »

Interesting: Mine went from 3.77 seconds to 0.04 seconds.

Nice.
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Wow!

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
chrisgapske
Cacti User
Posts: 278
Joined: Tue May 22, 2007 7:56 am
Location: Pensacola, Fl - Padacuh, Ky-Alpena, MI-Gulf Shores,AL

Re: some speedup for MAC Track

Post by chrisgapske »

I went from 10 seconds to .04?


| 2008-02-04 07:10:59 |
| 2008-02-04 07:25:46 |
| 2008-02-04 07:35:51 |
| 2008-02-04 07:50:54 |
| 2008-02-04 08:06:07 |
| 2008-02-04 08:20:41 |
| 2008-02-04 08:30:56 |
| 2008-02-04 08:40:57 |
| 2008-02-04 08:55:42 |
+---------------------+
2835 rows in set (0.04 sec)
ceyounger
Posts: 44
Joined: Fri Feb 10, 2006 2:59 pm
Location: Orange County, CA
Contact:

Post by ceyounger »

Nice catch!

I showed this to my DBAs and they said, "Duh!" :)

I'm no DBA...

Chris
msw1970
Cacti User
Posts: 206
Joined: Tue Jan 09, 2007 8:28 am
Location: London, UK

Post by msw1970 »

I went from 46.30 seconds to 0.02!!!! :o
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Ok, I feel pwn'd now... ;)

Larry
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
lavermil
Posts: 45
Joined: Thu Feb 15, 2007 2:25 pm
Location: Phoenix, Arizona

Post by lavermil »

TheWitness wrote:Ok, I feel pwn'd now... ;)

Larry
Is this going to be rolled into the next release?
dogs
Posts: 23
Joined: Wed Mar 14, 2007 10:00 am

Post by dogs »

Can someone give me more info on this please. I'm not too sure how i go about changing this.
User avatar
chrisgapske
Cacti User
Posts: 278
Joined: Tue May 22, 2007 7:56 am
Location: Pensacola, Fl - Padacuh, Ky-Alpena, MI-Gulf Shores,AL

Post by chrisgapske »

I believe you have to just go to a mysql cli and type


ALTER TABLE `mac_track_ports` ADD INDEX `scan_date` USING BTREE(`scan_date`);

it will add an index to your mactrack database making the seraching much faster.
dogs
Posts: 23
Joined: Wed Mar 14, 2007 10:00 am

Post by dogs »

thanks chris....... :)
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Committed to MacTrack 2.0 in Trunk.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests