Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 944669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:37:49+00:00 2026-05-15T22:37:49+00:00

I run a server that is getting killed by the number of requests it

  • 0

I run a server that is getting killed by the number of requests it is getting from one of our iPhone games for storing scores. By this I mean the server becomes unresponsive.

I only really know enough MySQL/PHP to get by, so I am floundering in my attempts to fix this. I am sure its a problem that can be optimised because we have a dedicated server. We handle only 300 requests a minute.

Basically we check the score someone is posting from their iPhone game (using a SELECT) to see if they have an existing score. If they do, and their new score is better, we do an UPDATE, otherwise we do an INSERT. The statements look like this:

$sql = “SELECT id,score,level FROM $table WHERE board=’$board’ AND name=’$name’ AND udid = ‘$udid’ AND fbuid = ‘$fbuid'”

The UPDATE and INSERT statements look like this:

$sql = “UPDATE $table SET score=’$score’, level=’$level’, country=’$country’, date=CURRENT_TIMESTAMP WHERE board=’$board’ AND name=’$name’ AND udid = ‘$udid’ AND fbuid = ‘$fbuid'”

$sql = “INSERT INTO $table(board, udid, fbuid, name, score, level, country) VALUES (‘$board’, ‘$udid’, ‘$fbuid’, ‘$name’, ‘$score’, ‘$level’, $country’)”

And for completeness, here is the definition for the table:

CREATE TABLE $table (
id int(11) NOT NULL auto_increment,
board tinyint(4) NOT NULL,
udid varchar(45) default NULL,
fbuid bigint(20) unsigned default NULL,
name varchar(25) default NULL,
country tinyint(4) default NULL,
level tinyint(4) default NULL,
score decimal(10,0) default NULL,
date timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (id),
KEY scoreidx (score),
KEY udididx (udid),
KEY fbuididx (fbuid),
KEY boardidx (board),
KEY levelidx (level),
KEY countryidx (country)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

I currently connect to the MySQL server from PHP using:

$conn = mysql_pconnect(DB_HOST,DB_USER,DB_PASSWORD,MYSQL_CLIENT_INTERACTIVE);

But used to use msql_connect previously, but did not notice an improvement with that.

Any pointers on how I can optimise this, or links to any web pages that describe what I should be doing would be HUGELY appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:37:50+00:00Added an answer on May 15, 2026 at 10:37 pm

    MyISAM has table-locks instead of the InnoDB row-locks. You could create a copy of your table, alter the engine to InnoDB, and (on a testserver) test the load with mysqlslap or similar stress testing tools.

    Also, very important:

    ALTER TABLE tablename ADD INDEX(board,name,udid,fbuid)
    

    MySQL can only use 1 index at a time, so your several ‘loose’ ones don’t do that much good when always querying for this specific combination.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Occasionally I run into this limitation using SQL Server 2000 that a row size
I am creating a site for me only that will run from my server.
I have a .cfc on my server that I use to run a query
I'm trying to implement a socket server that will run in most shared PHP
Can I make my own jabber server.So that if I run my website xyz
So I'm writing a program that is suppose to run forever (client server stuff)
I am writing a program that needs to run a java.jar server. I need
I run an installation of Ubuntu as a server. I have noticed that it
I have a 32-bit application that must run on a Windows x64 server using
I've got an MS SQL Server table that records our plant's alarm events with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.