简体   繁体   English

我是否需要编写代码来排队来自iOS应用程序的服务器请求?

[英]Do I need to write code to queue server requests from iOS application?

I am a bit new to the server side of computers. 我对计算机的服务器端有点陌生。 I am working on a social type game. 我正在开发社交游戏。 Currently I have a local development setup using the Apache server on the Mac which is running phpmyadmin and a MySQL database. 目前,我在运行phpmyadmin和MySQL数据库的Mac上使用Apache服务器进行本地开发设置。 The app posts data to the server using the non asynchronous function. 该应用程序使用非异步功能将数据发布到服务器。 I am trying to go to the next phase of testing which will involve more users so I need to look at web hosting. 我正在尝试进入下一阶段的测试,该阶段将涉及更多的用户,因此我需要研究网络托管。 The amount of data that is sent between the app and the server is vary limited JSON type which basically consists of parameters that have been read from or posted to the database. 在应用程序和服务器之间发送的数据量是有限的JSON类型,该类型基本上由已从数据库读取或发布到数据库的参数组成。 Correct me if I am wrong but I think a shared hosting setup will do for now. 如果我错了,请纠正我,但我认为共享主机设置现在可以执行。 I'm not sure of the point at which I will need to consider vps but I am sure that is down the road. 我不确定是否需要考虑vps,但是我确定这是即将发生的事情。 Will I need to write code to queue the requests to a server in a shared or vps hosted environment? 我是否需要编写代码以将请求排队到共享或vps托管环境中的服务器? Only one person would be able to change a given row at a time anyways due to the game setup (turn based). 由于游戏设置(基于回合),无论如何一次只有一个人可以更改给定的行。

How many users at one a given time would a shared host allow? 共享主机在给定时间内可以允许多少个用户? Is it correct that only one person has access to the database at a given instance in time? 在给定的实例中只有一个人有权访问数据库是否正确? What happens if two people execute the pho script at the same time? 如果两个人同时执行pho脚本会怎样? Would both requests be executed? 两个请求都将执行吗? Thanks in advance for any guidance you can provide. 在此先感谢您提供的任何指导。

You only need to write code to handle queue if you want to postpone the execution or if the server can't handle the load. 如果您要推迟执行或服务器无法处理负载,则只需要编写代码来处理队列。

For exemple , if your shared hosting only allow one simultaneous connection to your database , you maybe want to handle a queue instead of letting the user wait or fail. 例如,如果您的共享主机仅允许一个同时连接到数据库,则您可能想处理一个队列,而不是让用户等待或失败。

It's nearly impossible to say how many a shared hosting can handle. 几乎不可能说出共享托管可以处理多少个主机。 There is a lot of parameters that can affect the performance. 有很多参数会影响性能。

If two people execute a script at the same time there is 2 possibilities : The database can handle multiple simultaneous connections : no problem The database is limited to one connection (can happen on shared hosting) : one request will be the first and the second will fail with an error from your database engine. 如果两个人同时执行一个脚本,则有两种可能性:数据库可以同时处理多个连接:没问题数据库被限制为一个连接(可以在共享主机上发生):一个请求将是第一个,第二个将是因数据库引擎错误而失败。

A workaround is to use persistent connection to your DBMS and it will allow the first request to execute and the second to hang until the first one is completed. 一种解决方法是使用与DBMS的持久连接,它将允许第一个请求执行,而第二个请求挂起,直到第一个请求完成。 A optimised sql code is also a good workaround. 优化的sql代码也是一个很好的解决方法。 The quickest your queries execute the less you can have concurrent access. 查询执行得越快,您可以并行访问的次数就越少。

Not that having 10 users using your app is not the same thing that having 10 simultaneous connection. 并不是说有10个用户使用您的应用程序与10个同时连接是一回事。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法分配内存,无法创建子进程:是否需要对PHP映像请求进行排队? - Cannot allocate memory, couldn't create child process : Do I need to queue the PHP-image requests? 我是否需要服务器上的ssl证书才能向https://x.com发出SOAP请求? - Do I need an ssl certificate on my server to make SOAP requests to https://x.com? 如何使用表单中的内容将文件写入服务器? - How do I write a file to my server with the contents from a form? 我是否需要清理从文件中获取的 php 代码? - Do I need to sanitize php code im fetching from files? 我需要在哪个文件中编写代码以在symfony2中为EventDispatcher附加侦听器 - In which file do i need to write code for attaching listener for EventDispatcher in symfony2 onChange function 一键停止,我需要写什么代码才能无限期地继续? (Javascript) - onChange function stops after one click, what code do I need to write so that it continues indefinitely? (Javascript) 如何公开要从Wordpress管理面板运行的Swift代码(iOS应用程序),例如php服务器代码 - How to expose Swift code (iOS application) to be run from Wordpress admin panel like php server code 从Web服务器到iOS的JSON队列的后台队列 - Background queue to get a JSON array from web server to iOS 我是否需要修改这个mod重写代码,如果我添加SSL证书到我的服务器? - Do I need to modify this mod-rewrite code if I add an SSL certificate to my server? 我是否需要远程登录才能通过php脚本从MySQL数据库读取和写入? - Do I need remote login to can read and write from a MySQL database via a php script?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM