LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-14-2011, 05:51 PM   #1
jnyunt
LQ Newbie
 
Registered: Jun 2008
Posts: 26

Rep: Reputation: 0
inserting xml data into mysql taking so long


Hi All,

I have about 200k data entries in xml file. I wrote php script (using php-xml) to read xml file and insert into mysql. At first it went really quickly inserting, then after a while after inserting 100k entries, it slowed right down, just like it would not even doing anything. I have CentOs with 512M on VirtualBox running as server. Could anyone suggest why it happens like that?

Many thanks in advance
 
Old 06-15-2011, 08:34 AM   #2
travisdh1
Member
 
Registered: Sep 2008
Distribution: Fedora
Posts: 129

Rep: Reputation: 22
With only 512MB of RAM for the virtualbox image I wonder if it's not running out of memory and having to use swap which could cause this. Do you have a graphical desktop installed on the server? (Like Gnome or KDE) If so it would be good to give it more ram to use.
 
Old 06-16-2011, 03:10 AM   #3
jnyunt
LQ Newbie
 
Registered: Jun 2008
Posts: 26

Original Poster
Rep: Reputation: 0
Thanks for reply,
You are right. I increased that to 4G of RAM and it went quickly finished within 1 or 2hrs. I didn't realize that mysql would need such memory. So what if you have million of entries to insert. What would we do?
 
Old 06-16-2011, 10:18 AM   #4
travisdh1
Member
 
Registered: Sep 2008
Distribution: Fedora
Posts: 129

Rep: Reputation: 22
Oh, there are lots of different ways to go about performance tuning mysql. I'd start at mysql homepage. I've signed up for the newsletter and find it very informative even tho we don't currently use mysql at work.

One difference is the whole gui environment itself. I like using them (actually, I'm bad about doing lots of stuff in a gui that I should really just stick to a command line) but they can use an awful lot of system resources so the first thing I'd try is starting the system in a command line only mode (init 4? I forget which one to use ) In this case you can always run the server without a gui running and still use a client for the mysql server on a different system.

The other thing I'd suspect when using virtualbox is what type of disk image is used as a dynamically expanding disc can cause lots more io overhead when the disc needs to grow. Maybe try moving to a fixed size disc and see if that helps.

I'm no expert obviously but I hope I at least pointed you in the right direction.
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
why do i get this error when inserting data to a mysql table verbatim Programming 2 06-15-2005 06:12 AM
I need help with inserting data into mysql w/ PHP lostboy Programming 3 08-25-2003 12:08 PM
inserting data in mysql zuessh Linux - Software 4 05-19-2003 01:00 PM
Problem Inserting MySQL data from PHP! rhuser Linux - Software 9 03-03-2003 07:56 PM
MySQL - Inserting Data Not Happening! Rhapsodic Programming 4 10-26-2002 10:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration