Scripts
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb Site ManagementScripts

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 22nd, 2009, 02:10 PM
cardine cardine is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Maryland
Posts: 118 cardine User rank is Sergeant Major (2000 - 5000 Reputation Level)cardine User rank is Sergeant Major (2000 - 5000 Reputation Level)cardine User rank is Sergeant Major (2000 - 5000 Reputation Level)cardine User rank is Sergeant Major (2000 - 5000 Reputation Level)cardine User rank is Sergeant Major (2000 - 5000 Reputation Level)cardine User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Day 2 h 40 m 33 sec
Reputation Power: 56
Best Language for Fast Database Interaction

I currently have a project I have just finished coding in PHP. It does everything it is supposed to do, however it is far too slow. I plan on having one run through of the script read/write over 1,000,000 different values from/into a database (currently MySQL). However, PHP/MySQL is far too slow with this... it takes way to long simply to do 10,000 read/writes. Besides reading databases, the program only uses loops, basic variable operations, and randomly generating numbers.

So I am wondering what is the best programming language/database combination is for reading/writing into a database at peak speed/efficiency.

Reply With Quote
  #2  
Old June 22nd, 2009, 05:06 PM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Lost in code
Click here for more information.
 
Join Date: Dec 2004
Posts: 7,931 E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 2 Months 7 h 43 m 47 sec
Reputation Power: 6991
Reading and writing 1 million average sized records is going to take a pretty good amount of time regardless of what language and database you do it with. Rather than rewriting your script, you're probably better of trying to find some way to not have to read and write so many records at once. Perhaps better caching of some type? It's hard to say without actually knowing what you're doing.

It's also hard to say whether the time you're experiencing is unreasonable since we don't know what type of records you're updating or what your code looks like.

Reply With Quote
  #3  
Old June 22nd, 2009, 06:02 PM
cardine cardine is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Maryland
Posts: 118 cardine User rank is Sergeant Major (2000 - 5000 Reputation Level)cardine User rank is Sergeant Major (2000 - 5000 Reputation Level)cardine User rank is Sergeant Major (2000 - 5000 Reputation Level)cardine User rank is Sergeant Major (2000 - 5000 Reputation Level)cardine User rank is Sergeant Major (2000 - 5000 Reputation Level)cardine User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Day 2 h 40 m 33 sec
Reputation Power: 56
The time it is taking is reasonable, however I know that since PHP is an interpreted language it can be done faster.

I am building a neural network, so the program basically runs by reading/writing hundreds of thousands of database values before giving an output. I understand there are hardware computational limits, and I understand that you can try to make your code more efficient. I am wondering what programming language would be best for this program to run in, and what database would be the best to store the neural network.

Reply With Quote
  #4  
Old June 23rd, 2009, 10:27 AM
myndconsulting myndconsulting is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2009
Location: Davao City, Philippines
Posts: 27 myndconsulting New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 12 h 18 m 16 sec
Reputation Power: 0
PHP/MySQL in my opinion is a good combination for web development. You might need to optimize your code and database design.

I can't think of a faster combination.

P.S.: Good luck using Java..

Reply With Quote
  #5  
Old June 23rd, 2009, 11:26 AM
medialint's Avatar
medialint medialint is offline
Type Cast Exception
Dev Shed God 20th Plane (14500 - 14999 posts)
 
Join Date: Apr 2004
Location: OAKLAND CA | Adam's Point (Fairyland)
Posts: 14,938 medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)medialint User rank is General 112nd Grade (Above 100000 Reputation Level)  Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Months 2 Weeks 2 Days 13 m 33 sec
Reputation Power: 8490
Facebook
One thing that makes a huge difference is where the database is vs where the application is. If it's all on the same server then you're not going to get much faster, but otherwise your network comes into play. I work in san francisco and having to query database servers in minneapolis and phoenix. So sometimes I'll commandeer another server in one of these locations to run whatever job I need run because though they might not even be in the same building, running a job in the same city at least sure does help performance :-) This probably doesn't apply here though so I'm ranting needlessly.

Optimize your database and make sure it's properly indexed and you don't have a lot of needlessly large varchars you don't really need and such. You might want to take your design over the the mysql forum and ask there if you could make your design more efficient. This will probably be your best immediate bet to gain efficiency.
__________________
medialint.com

“Today you are You, that is truer than true. There is no one alive who is Youer than You.” - Dr. Seuss

Reply With Quote
  #6  
Old June 23rd, 2009, 07:09 PM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Lost in code
Click here for more information.
 
Join Date: Dec 2004
Posts: 7,931 E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 2 Months 7 h 43 m 47 sec
Reputation Power: 6991
Quote:
The time it is taking is reasonable, however I know that since PHP is an interpreted language it can be done faster.

You posted in the scripts forum, pretty much all of the languages discussed here are interpreted

Anyway, yes you are correct that an interpreted language is much slower than a compiled language. The fastest reasonable option is going to be C/C++. Java would be faster than PHP too, but not as fast as C/C++. Both of those languages are compiled languages, it is unlikely that you could find another interpreted/scripting language that is considerably faster than PHP.

Quote:
I am building a neural network, so the program basically runs by reading/writing hundreds of thousands of database values before giving an output. I understand there are hardware computational limits, and I understand that you can try to make your code more efficient. I am wondering what programming language would be best for this program to run in, and what database would be the best to store the neural network.

In this case your issue is almost certainly not the programming language but the database itself.


Your best bet is to switch over to C/C++, get a ton of RAM, load everything in the database into memory, and then use the copy stored in memory to perform your processing.

Reply With Quote
  #7  
Old June 23rd, 2009, 11:12 PM
cardine cardine is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Maryland
Posts: 118 cardine User rank is Sergeant Major (2000 - 5000 Reputation Level)cardine User rank is Sergeant Major (2000 - 5000 Reputation Level)cardine User rank is Sergeant Major (2000 - 5000 Reputation Level)cardine User rank is Sergeant Major (2000 - 5000 Reputation Level)cardine User rank is Sergeant Major (2000 - 5000 Reputation Level)cardine User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Day 2 h 40 m 33 sec
Reputation Power: 56
Since the script itself is very small it makes the most sense for the script to be on the same server as the database, so I won't run into any problems with distance.

Would writing an extension for PHP in C/C++ be the optimal way to do this?

At the time I wrote the code (it seemed like the most effecient way at the time) wrote the code so that it would always store the database information into an array before actually doing any calculations with it.

Also for a server, would you recommend an 8 Core server with 8GB of RAM or a 4 Core server with 12GB of RAM? My budget allows me to basically chose one or the other. Although the database will be 1,000,000+ rows it is only 1-2GB in size.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb Site ManagementScripts > Best Language for Fast Database Interaction

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap