如何在一小时内向数据库发出超过1500个查询请求? [英] How do I make more than 1500 query request to database within an hour?

查看:55
本文介绍了如何在一小时内向数据库发出超过1500个查询请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个聊天应用程序。

消息显示在消息框中,该消息框每隔10毫秒通过ajax不断从数据库中获取更新的消息。

即时在消息框中看到发送的每条新消息。所以它给人一种真实聊天的幻觉,毫不拖延。

我的问题是一旦应用程序上线,我被告知一个mysql帐户

不能超过1500的查询请求每小时从数据库查询。



我尝试过:



我用Google搜索并发现需要使用Grant表进行一些调整,这样可以将条形图提高到无限制。在做了一些研究之后,我最终完成了我的数据库,不仅是这个项目,还有其他人以及我本地的xampp服务器。很难过。



我只需要知道授权表是解决问题的唯一方法,还是有另一种方法。

I have made a chat application.
The messages are being shown in the message box that is continuously fetching the updated messages from the databases every 10 ms through ajax.
Every new message sent is seen in the message box instantaneously. So it gives an illusion of real chat without delay.
My problem is once the application goes live, I am getting told that a mysql account
cannot exceed query request of 1500 queries per hour from database.

What I have tried:

I googled and found some tweaking needs to be done with Grant tables which allow to raise the bar to unlimited supposedly. After doing some research I ended up blowing my databases altogether of not only this project, but for others as well on my local xampp server. Sad.

I just need to know that is grant table the only way to workaround the problem or is there another way to it.

推荐答案

基本上,您需要更改您执行此操作的方式:如果您的托管服务限制您每小时1500个请求,那么这可能是您所有用户的1500个请求。所以如果你有1500个用户试图聊天,那么每个小时每个小时就有一个请求。



您需要更改您的托管服务(并且可能需要付费,我我们只看到像免费帐户那样的限制)或者将整个设计改为推模式而不是拉 - 可能两者都有,因为每小时1500请求在请求之间的60 * 60/1500 = 2.4秒时工作一般。随着用户数量随着您当前的方法而上升,即使付费帐户也会变得非常缓慢和繁琐 - 当我ping Google.com时,往返时间超过10毫秒,因此您的整个系统将会失败,因为请求只会到达目的地在你开始制作另一个之前,更不用说访问数据库并回到你的客户端了!



试试这个:打开一个新的CMD窗口并输入PING nameOfYourDomain然后按回车键。

Basically, you need to change the whole way you are doing this: if your hosting service restricts you to 1500 requests an hour, then that is probably 1500 requests across all of your users. so if you have 1500 users trying to chat, that's one request per hour each.

You will need to either change your hosting service (and probably pay for it, I've only seen limits like that with free accounts) or change your whole design to a "push" model rather than "pull" - probably both, since a 1500 request per hour works out at 60 * 60 / 1500 = 2.4 seconds between requests on average. Even paid for accounts are going to get pretty slow and cumbersome as user numbers rise with your current method - when I ping Google.com, the round trip time exceeds 10 ms so your whole system is going to fail because requests will only just reach the destination before you start making another, let alone access the DB and get back to your client!

Try this: open a new CMD window and type "PING nameOfYourDomain" then press enter.
ping google.com
ping codeproject.com

如果time =下的值不小于超过10毫秒(并且他们不会)你的系统将非常非常快地打结...

If the values under "time=" aren't less than 10ms (and they won't be) your system will tie itself in knots very, very quickly ...


这篇关于如何在一小时内向数据库发出超过1500个查询请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆