简体   繁体   English

为什么在AppEngine / Java中默认禁用并发请求?

[英]Why are concurrent requests disabled by default in AppEngine/Java?

Much to my surprise I found out that AppEngine applications server requests serially. 令我惊讶的是,我发现AppEngine应用程序服务器连续请求。 Recently Java applications have the possiblity to server requests concurrently , which is disabled by default ( reference ). 最近,Java应用程序可以同时处理服务器请求,默认情况下禁用它( 引用 )。

What is the reason for concurrent request being disabled by default? 默认情况下禁用并发请求的原因是什么? Web applications are by their nature meant to serve multiple requests concurrently, whether they are written in Java, Python or PHP. Web应用程序本质上意味着同时为多个请求提供服务,无论它们是用Java,Python还是PHP编写的。 It seems to me like this is an artificial limitation. 在我看来,这是一个人为的限制。

This may have something to do with AppEngine at the beginning not supporting concurrent requests. 这可能与AppEngine在开始时没有支持并发请求有关。 The feature was only added for Java in version 1.4.3 (March 30, 2011). 该功能仅在1.4.3版本(2011年3月30日)中为Java添加。 So some developers may have coded and tested their applications to behave properly only against a single thread at a time. 因此,一些开发人员可能已编码并测试其应用程序,以便一次只对单个线程正常运行。

Once Google built the infrastructure and code to support concurrent requests they may have been wary about enabling concurrency by default, as it could break existing applications. 一旦谷歌构建了支持并发请求的基础架构和代码,他们可能一直担心默认启用并发,因为它可能会破坏现有的应用程序。 Hence the reason for the opt in approach. 因此选择接近的原因。

There are some GAE folk who check StackOverflow, so we might need to hear from them to be sure. 有一些GAE人检查StackOverflow,所以我们可能需要听取他们的意见。

I think that is the better option by default as many novice programmers are coding on appengine and expect minimalistic approach than scale/volume. 我认为这是默认情况下更好的选择,因为许多新手程序员正在对appengine进行编码并期望采用简约方法而不是缩放/音量。

Concurrent PHP or python (process based) wont messup object data but Java can (thread based). 并发PHP或python(基于进程)不会弄乱对象数据,但Java可以(基于线程)。 That is the main difference. 这是主要的区别。

可能是为了避免已经部署的应用程序的回归而不是线程安全...

In GAE doc, the "Note: If you wish to use concurrent requests, your application code needs to use proper thread synchronization before you enable ." 在GAE doc中,“注意:如果您希望使用并发请求,则在启用之前,您的应用程序代码需要使用正确的线程同步。” is quite explicit about the danger of concurrent requesting. 关于并发请求的危险是非常明确的。
As other people said above, this is less dangerous not to allow this feature by default and to provide it to advanced developers who go deeper in the documentation. 正如上面其他人所说的那样,默认情况下不允许使用此功能并将其提供给深入开发文档的高级开发人员则不那么危险。
Yet, it is written quite small and at the end of the doc so it's not easy to see it :) 然而,它写的很小,在文档的最后,所以它不容易看到它:)

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

相关问题 如何通过objectify确保与Appengine实体上的并发请求的一致性? - How to ensure consistency with concurrent requests on Appengine entities with objectify? Java 和/或 Spring 引导中的并发异步 HTTP 请求 - Concurrent asynchronous HTTP requests in Java and/or Spring Boot 如何在Java App Engine中迁移到并发请求? - How to migrate to concurrent requests in Java App Engine? 并发多线程请求的 Java OKHTTP SocketTimeoutException - Java OKHTTP SocketTimeoutException with concurrent multithreaded requests Java并发哈希图中的clear的默认行为是什么 - What is the default behavior of clear in java concurrent hashmap gcloud:云存储的附录中的默认应用程序凭据(java) - gcloud: Default Application Credentials in appengine for Cloud Storage (java) 服务器无法使用Java在HTTP / 1.1 Client中响应并发请求 - Server does not respond to concurrent requests in HTTP/1.1 Client using Java 为什么java.util.concurrent.FutureTask不可序列化 - Why is java.util.concurrent.FutureTask not serializable 为什么TimeUnit是java.util.concurrent的成员? - Why is TimeUnit a member of java.util.concurrent? 为什么Clojure而不是Java用于并发编程 - Why Clojure instead of Java for concurrent programming
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM