Hello,
The table has about less than 50 records.
And the query like :  SELECT a,b,c,d FROM test_table  WHERE id = 123 LIMIT 1

I have 200 clients ( now increasing)  *online at a moment  *who have to get
infomation every 500 miliseconds.
So Server.js have to do more than 400 queries  every seconds.
Do you think mysql can handle ?

And btw, I have a problem with my code. I dont understand why the code
doesn't work.
I try to alert before APE works, alert OK. But after  client.load(), alert
not OK.
Here is the code. please help me. Thank you very much.

On Wed, Feb 23, 2011 at 10:02 PM, Marco Orlandin <[email protected]> wrote:

> Sincerely how much complex is the query?
>
> MySQL can handle a "LOT" of query is tables are good indexed...
>
> On Wed, Feb 23, 2011 at 10:57 AM, Summer nguyen <[email protected]>
> wrote:
> > Dear all,
> > I have many data store in mysql database , and it's updated every second.
> > So I want to use APE Server.js to get infomation and broadcast to Clients
> > every 500 miliseconds.
> > I have many clients , so  I am afraid that mysql can not handle hundreads
> of
> > query per second, and every second.
> > I have an idea to use JAVA to write infomation to a XML file, then I use
> > server.js to get infomation from this XML file.
> > I am finding a solution to use server.js to get infomation from XML file.
> > anyone know, please help me. Thank you very much.
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "APE Project" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> > http://groups.google.com/group/ape-project?hl=en
> > ---
> > APE Project (Ajax Push Engine)
> > Official website : http://www.ape-project.org/
> > Git Hub : http://github.com/APE-Project/
> >
>
>
>
> --
> while ( ! ( succeed = try() ) );
>
> --
> You received this message because you are subscribed to the Google
> Groups "APE Project" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/ape-project?hl=en
> ---
> APE Project (Ajax Push Engine)
> Official website : http://www.ape-project.org/
> Git Hub : http://github.com/APE-Project/
>

-- 
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/
function MySQLConnect(ip, user, password, database) {
        var sql = new Ape.MySQL(ip + ":3306", user, password, database);

        //onConnect callback
        sql.onConnect = function() {
            Ape.log('You are now connected to MySQL server');
        }

        //onError callback
        sql.onError = function(errorNo) {
            Ape.log('Connection error ' + errorNo +' '+ this.errorString());
        }

        return sql;
    }
var sql = MySQLConnect('192.168.1.199', 'root', 'n3w-p4ssw0rd', 'woowvn');


    //Set up a pooller to send keep alive request each 2minutes
    (function() {
        sql.query('SELECT 1', function(res, errorNo) {
            if (errorNo == 8) {//Something went wrong, connection has been 
closed
                sql =  MySQLConnect('192.168.1.199', 'root', 'n3w-p4ssw0rd', 
'woowvn'); //Reconnect to MySQL Server
            }
        }.bind(this));
    }).periodical(500);

    //Register getInfo command
    Ape.registerCmd('getInfo', true, function(params, cmd) {
        //Get data from mysql table
        sql.query('SELECT a,b,c,d FROM test_table  WHERE id = 123 LIMIT 1', 
function(res, errorNo) {
             if (errorNo) {
                Ape.log('Request error : ' + errorNo + ' : '+ 
this.errorString());
                return ['101', 'MYSQL_ERROR'];
            } else {
                //Display to logs data received from mysql
                Ape.log('Fetching ' + res.length + ' result(s)');              

                cmd.sendResponse('info', res[0]);//Send first result to client
             }
        });
    })

<<attachment: countdown.php>>

Reply via email to