please, no: see https://meta.stackexchange.com/q/325416/295232
Source Link
Glorfindel
  • 3.1k
  • 6
  • 24
  • 33

if you down-vote, then please leave a comment why.
#downvoting-with-accountability

The biggest problems with asynchronous approach is that it's difficult to read (callback hell) and error prone (deadlocks, race conditions, etc) unless advanced language support is available. One example is async/await in C# or Node that makes the request processing code look "linear" and similar to thread-per-request/thread-per-connection.
Asynchronous approach may also be a bit slower due to synchronization overhead. However in case of IO-bound applications this is almost always insignificant.

if you down-vote, then please leave a comment why.
#downvoting-with-accountability

The biggest problems with asynchronous approach is that it's difficult to read (callback hell) and error prone (deadlocks, race conditions, etc) unless advanced language support is available. One example is async/await in C# or Node that makes the request processing code look "linear" and similar to thread-per-request/thread-per-connection.
Asynchronous approach may also be a bit slower due to synchronization overhead. However in case of IO-bound applications this is almost always insignificant.

The biggest problems with asynchronous approach is that it's difficult to read (callback hell) and error prone (deadlocks, race conditions, etc) unless advanced language support is available. One example is async/await in C# or Node that makes the request processing code look "linear" and similar to thread-per-request/thread-per-connection.
Asynchronous approach may also be a bit slower due to synchronization overhead. However in case of IO-bound applications this is almost always insignificant.

remove chimp experiment part
Source Link
morgwai
  • 119
  • 4

An analogy with one cruel behavioral experiment performed on chimps comes to mind:
a group of chimps was held in enclosure. They were well treated and fed, but without any abundance. Each day a few extra bananas were hanged from the roof near some tree, so chimps were quick to climb and get them. After that, each chimp got a device attached which could deliver non-dangerous but unpleasant electric shock. Each time a chimp grabbed an extra banana from the roof, it would get lightly electrocuted. Chimps quickly learned the rule and significantly reduced consumption of the extras (but not to 0).
During the next stage food ration was reduced and also the chimp who would try to grab an extra banana, would not get electrocuted. Instead all other chimps would get electrocuted significantly harder than before (not harmful still, but very unpleasant). Chimps quickly learned the new rule and whenever one of them started to climb to get an extra banana, he would get beatings from the rest. Quickly all chimps learned not to even try to climb for banana to avoid beatings.
At that time new chimps were introduced to the enclosure. Unaware of the rules, they were quickly attempting to climb for an extra bananas and would receive beatings from "the old guard". They quickly learned the rule, unaware of the reasons. When the next bunch of new chimps was introduced some time after, the previous bunch would even join the old guard in delivering the beatings to the newest bunch without understanding the reasons.
At that time all electrocuting devices were turned off: no one would get electrocuted when reaching for a banana, yet almost no one ever tried and if so, he would receive beatings immediately before reaching the roof: although the original reason was not valid anymore, the trend remained, enforced by the old guard and perpetuated by the whole group.
At the next step, all the old guard was moved the another enclosure: there was no valid reason for chimps not to grab extra bananas, no one of them even knew why the rule was introduced at all, yet they kept perpetuating it and kept teaching/enforcing it on newly added chimps on and on...
update: Now before more ppl get offended that I call them chimps, let me explain: we humans are prone to this kind of bias as well: that was the reason for the experiment: to point that our own rules and regulations should be periodically revisited and subjected to scrutiny. Even rules that were once valid and useful, may get outdated without anyone noticing. To not look far, I myself was telling everyone until mid 2010s that all servers should be asynchronous because having a thread per request is too expensive ;-] (I thought that physical 2MB of memory needs to be allocated at the thread creation, not just virtual address space)

An analogy with one cruel behavioral experiment performed on chimps comes to mind:
a group of chimps was held in enclosure. They were well treated and fed, but without any abundance. Each day a few extra bananas were hanged from the roof near some tree, so chimps were quick to climb and get them. After that, each chimp got a device attached which could deliver non-dangerous but unpleasant electric shock. Each time a chimp grabbed an extra banana from the roof, it would get lightly electrocuted. Chimps quickly learned the rule and significantly reduced consumption of the extras (but not to 0).
During the next stage food ration was reduced and also the chimp who would try to grab an extra banana, would not get electrocuted. Instead all other chimps would get electrocuted significantly harder than before (not harmful still, but very unpleasant). Chimps quickly learned the new rule and whenever one of them started to climb to get an extra banana, he would get beatings from the rest. Quickly all chimps learned not to even try to climb for banana to avoid beatings.
At that time new chimps were introduced to the enclosure. Unaware of the rules, they were quickly attempting to climb for an extra bananas and would receive beatings from "the old guard". They quickly learned the rule, unaware of the reasons. When the next bunch of new chimps was introduced some time after, the previous bunch would even join the old guard in delivering the beatings to the newest bunch without understanding the reasons.
At that time all electrocuting devices were turned off: no one would get electrocuted when reaching for a banana, yet almost no one ever tried and if so, he would receive beatings immediately before reaching the roof: although the original reason was not valid anymore, the trend remained, enforced by the old guard and perpetuated by the whole group.
At the next step, all the old guard was moved the another enclosure: there was no valid reason for chimps not to grab extra bananas, no one of them even knew why the rule was introduced at all, yet they kept perpetuating it and kept teaching/enforcing it on newly added chimps on and on...
update: Now before more ppl get offended that I call them chimps, let me explain: we humans are prone to this kind of bias as well: that was the reason for the experiment: to point that our own rules and regulations should be periodically revisited and subjected to scrutiny. Even rules that were once valid and useful, may get outdated without anyone noticing. To not look far, I myself was telling everyone until mid 2010s that all servers should be asynchronous because having a thread per request is too expensive ;-] (I thought that physical 2MB of memory needs to be allocated at the thread creation, not just virtual address space)

grammar and rewording for readability
Source Link
morgwai
  • 119
  • 4

An analogy with one cruel behavioral experiment performed on chimps comes to mind:
a group of chimps was held in enclosure. They were well treated and fed, but without any abundance. Each day a few extra bananas were hanged from the roof near some tree, so chimps were quick to climb and get them. After that, each chimp got a device attached which could deliver non-dangerous but unpleasant electric shock. Each time a chimp grabbed an extra banana from the roof, it would get lightly electrocuted. Chimps quickly learned the rule and significantly reduced consumption of the extras (but not to 0).
During the next stage food ration was reduced and also the chimp who would try to grab an extra banana, would not get electrocuted. Instead all other chimps would get electrocuted significantly harder than before (not harmful still, but very unpleasant). Chimps quickly learned the new rule and whenever one of them started to climb to get an extra banana, he would get beatings from the rest. Quickly all chimps learned not to even try to climb for banana to avoid beatings.
At that time new chimps were introduced to the enclosure. Unaware of the rules, they were quickly attempting to climb for an extra bananas and would receive beatings from "the old guard". They quickly learned the rule, unaware of the reasons. When the next bunch of new chimps was introduced some time after, the previous bunch would even join the old guard in delivering the beatings to the newest bunch without understanding the reasons.
At that time all electrocuting devices were turned off: no one would get electrocuted when reaching for a banana, yet almost no one ever tried and if so, he would receive beatings immediately before reaching the roof: although the original reason was not valid anymore, the trend remained, enforced by the old guard and perpetuated by the whole group.
At the next step, all the old guard was moved the another enclosure: there was no valid reason for chimps not to grab extra bananas, no one of them even knew why the rule was introduced at all, yet they kept perpetuating it and kept teaching/enforcing it on newly added chimps on and on...
Nowupdate: Now before anyone getsmore ppl get offended that I call him a chimpthem chimps, please relaxlet me explain: we humans are prone to this kind of bias as well: that was the point ofreason for the researchexperiment: to point that our own rules and regulations should be periodically revisited and subjected to scrutiny. Even rules that were once valid and useful, may get outdated without anyone noticing. To not look far, I myself was telling everyone until mid 2010s that allall servers should be asynchronous because having a thread per request is too expensive ;-]
   (I thought that physical 2MB of memory needs to be allocated at the thread creation, not just virtual address space)

An analogy with one cruel behavioral experiment performed on chimps comes to mind:
a group of chimps was held in enclosure. They were well treated and fed, but without any abundance. Each day a few extra bananas were hanged from the roof near some tree, so chimps were quick to climb and get them. After that, each chimp got a device attached which could deliver non-dangerous but unpleasant electric shock. Each time a chimp grabbed an extra banana from the roof, it would get lightly electrocuted. Chimps quickly learned the rule and significantly reduced consumption of the extras (but not to 0).
During the next stage food ration was reduced and also the chimp who would try to grab an extra banana, would not get electrocuted. Instead all other chimps would get electrocuted significantly harder than before (not harmful still, but very unpleasant). Chimps quickly learned the new rule and whenever one of them started to climb to get an extra banana, he would get beatings from the rest. Quickly all chimps learned not to even try to climb for banana to avoid beatings.
At that time new chimps were introduced to the enclosure. Unaware of the rules, they were quickly attempting to climb for an extra bananas and would receive beatings from "the old guard". They quickly learned the rule, unaware of the reasons. When the next bunch of new chimps was introduced some time after, the previous bunch would even join the old guard in delivering the beatings to the newest bunch without understanding the reasons.
At that time all electrocuting devices were turned off: no one would get electrocuted when reaching for a banana, yet almost no one ever tried and if so, he would receive beatings immediately before reaching the roof: although the original reason was not valid anymore, the trend remained, enforced by the old guard and perpetuated by the whole group.
At the next step, all the old guard was moved the another enclosure: there was no valid reason for chimps not to grab extra bananas, no one of them even knew why the rule was introduced at all, yet they kept perpetuating it and kept teaching/enforcing it on newly added chimps on and on...
Now before anyone gets offended that I call him a chimp, please relax: we humans are prone to this kind of bias as well: that was the point of the research: to point that our own rules and regulations should be periodically revisited and subjected to scrutiny. Even rules that were once valid and useful, may get outdated without anyone noticing. To not look far, I myself was telling everyone until mid 2010s that all servers should be asynchronous because having a thread per request is too expensive ;-]
 (I thought that physical 2MB of memory needs to be allocated at the thread creation, not just virtual address space)

An analogy with one cruel behavioral experiment performed on chimps comes to mind:
a group of chimps was held in enclosure. They were well treated and fed, but without any abundance. Each day a few extra bananas were hanged from the roof near some tree, so chimps were quick to climb and get them. After that, each chimp got a device attached which could deliver non-dangerous but unpleasant electric shock. Each time a chimp grabbed an extra banana from the roof, it would get lightly electrocuted. Chimps quickly learned the rule and significantly reduced consumption of the extras (but not to 0).
During the next stage food ration was reduced and also the chimp who would try to grab an extra banana, would not get electrocuted. Instead all other chimps would get electrocuted significantly harder than before (not harmful still, but very unpleasant). Chimps quickly learned the new rule and whenever one of them started to climb to get an extra banana, he would get beatings from the rest. Quickly all chimps learned not to even try to climb for banana to avoid beatings.
At that time new chimps were introduced to the enclosure. Unaware of the rules, they were quickly attempting to climb for an extra bananas and would receive beatings from "the old guard". They quickly learned the rule, unaware of the reasons. When the next bunch of new chimps was introduced some time after, the previous bunch would even join the old guard in delivering the beatings to the newest bunch without understanding the reasons.
At that time all electrocuting devices were turned off: no one would get electrocuted when reaching for a banana, yet almost no one ever tried and if so, he would receive beatings immediately before reaching the roof: although the original reason was not valid anymore, the trend remained, enforced by the old guard and perpetuated by the whole group.
At the next step, all the old guard was moved the another enclosure: there was no valid reason for chimps not to grab extra bananas, no one of them even knew why the rule was introduced at all, yet they kept perpetuating it and kept teaching/enforcing it on newly added chimps on and on...
update: Now before more ppl get offended that I call them chimps, let me explain: we humans are prone to this kind of bias as well: that was the reason for the experiment: to point that our own rules and regulations should be periodically revisited and subjected to scrutiny. Even rules that were once valid and useful, may get outdated without anyone noticing. To not look far, I myself was telling everyone until mid 2010s that all servers should be asynchronous because having a thread per request is too expensive ;-]  (I thought that physical 2MB of memory needs to be allocated at the thread creation, not just virtual address space)

grammar and rewording for readability
Source Link
morgwai
  • 119
  • 4
Loading
grammar
Source Link
morgwai
  • 119
  • 4
Loading
note on java
Source Link
morgwai
  • 119
  • 4
Loading
note on downvoting
Source Link
morgwai
  • 119
  • 4
Loading
update on cache misses
Source Link
morgwai
  • 119
  • 4
Loading
note on physical memory limit
Source Link
morgwai
  • 119
  • 4
Loading
note on stateless
Source Link
morgwai
  • 119
  • 4
Loading
link to jetty article
Source Link
morgwai
  • 119
  • 4
Loading
note on big thread pools being not expensive any more
Source Link
morgwai
  • 119
  • 4
Loading
note on DB bound servers 2
Source Link
morgwai
  • 119
  • 4
Loading
note on other event systems
Source Link
morgwai
  • 119
  • 4
Loading
GUI programming note
Source Link
morgwai
  • 119
  • 4
Loading
Source Link
morgwai
  • 119
  • 4
Loading