Re: singlethreaded or multithreaded
thank you all for the inputs! xox bea Original-Nachricht Datum: Thu, 7 May 2009 07:03:05 +0300 Von: Nikos Balkanas nbalka...@gmail.com An: Stipe Tolj s...@tolj.org, Guillaume Cottenceau g...@mnc.ch CC: devel Devel devel@kannel.org Betreff: Re: singlethreaded or multithreaded Hi, Actualy I have been working a lot in that area recently, in wap. Kannel has a static thread structure, from beginning to end. The threads (22 for bearerbox, 18 for wapbox) serve to connect and move data between queues. The input/output character is single threaded in wapbox/bearerbox. I have implemended dynamic threads to the outgoing wap interface. Performance is not that much improved by it, if accessing from within the LAN, in fact threads will introduce some overhead due to thread manager and scheduling, and might run slightly slower. What threads do is make for a more robust software. Having introduced a 10 delay, as in real networks, between transmit and receive threads, wapbox can handle as many as 3 simultaneous users before timing out (30 delay). The threaded design can handle thousands of simultaneous users with the same baseline delay of 10 each. It is quite easy to find for yourself the smsbox character. Start top and watch the number of threads. Generate some load, and if the character is multithreaded, you will see threads increasing. Else it is sequential in character. BR, Nikos - Original Message - From: Guillaume Cottenceau g...@mnc.ch To: Stipe Tolj s...@tolj.org Cc: devel Devel devel@kannel.org Sent: Wednesday, May 06, 2009 7:28 PM Subject: Re: singlethreaded or multithreaded Stipe Tolj st 'at' tolj.org writes: The HTTP client layer in gwlib/http.[ch] works this way: We look for a connection to the target host in our connection pool. If we have one in the pool we grep it and use it, if we don't have one, we create a TCP connection to the host. As soon as the request/response transaction is finished, and we run in Keep-Alive mode (HTTP/1.1) we will put the connection back to the pool. Well, what does that mean? we create as man connections (there is no hard limit per host target), as the re-cycling of the connection is put back into the pool. This is a pretty hard way to hit the HTTP server. We get a lot of complains that we break HTTP servers by hitting it too hard ;) Actually, the parallelization achieved is quite very good, and adding the power of C and pthreads it allows a very good performance, seemingly. In my company, we use the tomcat java web application server, backed by a postgresql database. Once upon a time, we decided to ask for as many DLRs as operators/kannel could produce, and it ended up in breaking tomcat within a few years during a DLR peak time, because each DLR would produce a synchronous database request in our application. So I quickly redesigned that for a production/consumer FIFO queue optimized for fast production in our java application, with only one consumer thread performing the actual DLR processing involving the database query, and it is now entirely fine. In other words, the bottleneck was in our bad software design, and database performance, that the HTTP server itself (yet, it's written in pure java). In production, IIRC I have seen as many as hundreds of DLRs received from a single SMSC link per second (even if operators would never accept as many submitted SMS's per second as that, but that's a different story), an amount kannel was totally fine with (on a midprice dell xeon server several years old) - and also tomcat. -- Guillaume Cottenceau -- Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
Re: singlethreaded or multithreaded
What do you mean by DLR request? Kannel asks the SMSC to report back. The SMSC will report whenever something is happening and kannel forwards it to http. On 06.05.2009, at 16:18, Beatrice Tamburrino wrote: hi, how does kannel send the dlr-requests? sequentiell? or pararell multithreaded?? xox bea -- Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01
Re: singlethreaded or multithreaded
Andreas Fink afink 'at' list.fink.org writes: What do you mean by DLR request? Kannel asks the SMSC to report back. The SMSC will report whenever something is happening and kannel forwards it to http. In the context, I suppose the question was about kannel-application DLR transport (HTTP), not operator-kannel. On 06.05.2009, at 16:18, Beatrice Tamburrino wrote: hi, how does kannel send the dlr-requests? sequentiell? or pararell multithreaded?? xox bea -- Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01 -- Guillaume Cottenceau
Re: singlethreaded or multithreaded
Hi, I am writing a little webserver for an extern application, this webserver should handle the incoming http request which kannel calls with the dlr-url given. Now, the question is, if kannel forwards the http request sequentiel, i won't need to take care of the multithreaded stuff.. well, I took a look at the source code but i wasn't able to find something.. Original-Nachricht Datum: Wed, 6 May 2009 16:23:54 +0200 Von: Andreas Fink af...@list.fink.org An: Beatrice Tamburrino beatrice.tamburr...@gmx.ch CC: devel Devel devel@kannel.org Betreff: Re: singlethreaded or multithreaded What do you mean by DLR request? Kannel asks the SMSC to report back. The SMSC will report whenever something is happening and kannel forwards it to http. On 06.05.2009, at 16:18, Beatrice Tamburrino wrote: hi, how does kannel send the dlr-requests? sequentiell? or pararell multithreaded?? xox bea -- Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01 -- Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
Re: singlethreaded or multithreaded
exactly :) Original-Nachricht Datum: Wed, 06 May 2009 16:27:03 +0200 Von: Guillaume Cottenceau g...@mnc.ch An: Andreas Fink af...@list.fink.org CC: devel Devel devel@kannel.org Betreff: Re: singlethreaded or multithreaded Andreas Fink afink 'at' list.fink.org writes: What do you mean by DLR request? Kannel asks the SMSC to report back. The SMSC will report whenever something is happening and kannel forwards it to http. In the context, I suppose the question was about kannel-application DLR transport (HTTP), not operator-kannel. On 06.05.2009, at 16:18, Beatrice Tamburrino wrote: hi, how does kannel send the dlr-requests? sequentiell? or pararell multithreaded?? xox bea -- Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01 -- Guillaume Cottenceau
Re: singlethreaded or multithreaded
thx! I probably will do it multithreaded.. any idea where to find the sending process in the source code? Original-Nachricht Datum: Wed, 6 May 2009 17:15:49 +0200 Von: Andreas Fink af...@list.fink.org An: Beatrice Tamburrino beatrice.tamburr...@gmx.ch CC: devel Devel devel@kannel.org Betreff: Re: singlethreaded or multithreaded I think you should for sure be able to accept multiple simultaneous incoming connections as its in the nature of a webserver. If you process them sequentially or more than one in parallel is then a performance issue. Kannel for sure doesnt stop working until it got the answer from the webserver as its written asynchronously. So it can have multiple parallel requests to multiple servers (this happens especially during WAP use). I'm not 100% sure how it handles requests to the same server as there it can keep a connection open and reuse it (HTTP Keepalive) but it for sure would not hurt your software to be able to handle a few requests in parallel as it would give you speed. On 06.05.2009, at 16:30, Beatrice Tamburrino wrote: Hi, I am writing a little webserver for an extern application, this webserver should handle the incoming http request which kannel calls with the dlr-url given. Now, the question is, if kannel forwards the http request sequentiel, i won't need to take care of the multithreaded stuff.. well, I took a look at the source code but i wasn't able to find something.. Original-Nachricht Datum: Wed, 6 May 2009 16:23:54 +0200 Von: Andreas Fink af...@list.fink.org An: Beatrice Tamburrino beatrice.tamburr...@gmx.ch CC: devel Devel devel@kannel.org Betreff: Re: singlethreaded or multithreaded What do you mean by DLR request? Kannel asks the SMSC to report back. The SMSC will report whenever something is happening and kannel forwards it to http. On 06.05.2009, at 16:18, Beatrice Tamburrino wrote: hi, how does kannel send the dlr-requests? sequentiell? or pararell multithreaded?? xox bea -- Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01 -- Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a -- Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
Re: singlethreaded or multithreaded
Beatrice, May I ask why are you going to develop a custom web server instead of using any of the well-proven open source alternatives already available? Regards, -- Alejandro Guerrieri aguerri...@kannel.org On 06/05/2009, at 17:28, Beatrice Tamburrino wrote: thx! I probably will do it multithreaded.. any idea where to find the sending process in the source code? Original-Nachricht Datum: Wed, 6 May 2009 17:15:49 +0200 Von: Andreas Fink af...@list.fink.org An: Beatrice Tamburrino beatrice.tamburr...@gmx.ch CC: devel Devel devel@kannel.org Betreff: Re: singlethreaded or multithreaded I think you should for sure be able to accept multiple simultaneous incoming connections as its in the nature of a webserver. If you process them sequentially or more than one in parallel is then a performance issue. Kannel for sure doesnt stop working until it got the answer from the webserver as its written asynchronously. So it can have multiple parallel requests to multiple servers (this happens especially during WAP use). I'm not 100% sure how it handles requests to the same server as there it can keep a connection open and reuse it (HTTP Keepalive) but it for sure would not hurt your software to be able to handle a few requests in parallel as it would give you speed. On 06.05.2009, at 16:30, Beatrice Tamburrino wrote: Hi, I am writing a little webserver for an extern application, this webserver should handle the incoming http request which kannel calls with the dlr-url given. Now, the question is, if kannel forwards the http request sequentiel, i won't need to take care of the multithreaded stuff.. well, I took a look at the source code but i wasn't able to find something.. Original-Nachricht Datum: Wed, 6 May 2009 16:23:54 +0200 Von: Andreas Fink af...@list.fink.org An: Beatrice Tamburrino beatrice.tamburr...@gmx.ch CC: devel Devel devel@kannel.org Betreff: Re: singlethreaded or multithreaded What do you mean by DLR request? Kannel asks the SMSC to report back. The SMSC will report whenever something is happening and kannel forwards it to http. On 06.05.2009, at 16:18, Beatrice Tamburrino wrote: hi, how does kannel send the dlr-requests? sequentiell? or pararell multithreaded?? xox bea -- Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01 -- Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a -- Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
Re: singlethreaded or multithreaded
Hi Alejandro, The webserver should be part of a big software engine which my company develops. we also use the apache server but for incoming traffic, we need a custom build one for overviewing the requests. anyway, its not a big deal to write a webserver, but I'm really interested on how the output-requests are done? maybe you have an idea? Original-Nachricht Datum: Wed, 6 May 2009 17:41:15 +0200 Von: Alejandro Guerrieri aguerri...@kannel.org An: Beatrice Tamburrino beatrice.tamburr...@gmx.ch CC: Andreas Fink af...@list.fink.org, devel@kannel.org Betreff: Re: singlethreaded or multithreaded Beatrice, May I ask why are you going to develop a custom web server instead of using any of the well-proven open source alternatives already available? Regards, -- Alejandro Guerrieri aguerri...@kannel.org On 06/05/2009, at 17:28, Beatrice Tamburrino wrote: thx! I probably will do it multithreaded.. any idea where to find the sending process in the source code? Original-Nachricht Datum: Wed, 6 May 2009 17:15:49 +0200 Von: Andreas Fink af...@list.fink.org An: Beatrice Tamburrino beatrice.tamburr...@gmx.ch CC: devel Devel devel@kannel.org Betreff: Re: singlethreaded or multithreaded I think you should for sure be able to accept multiple simultaneous incoming connections as its in the nature of a webserver. If you process them sequentially or more than one in parallel is then a performance issue. Kannel for sure doesnt stop working until it got the answer from the webserver as its written asynchronously. So it can have multiple parallel requests to multiple servers (this happens especially during WAP use). I'm not 100% sure how it handles requests to the same server as there it can keep a connection open and reuse it (HTTP Keepalive) but it for sure would not hurt your software to be able to handle a few requests in parallel as it would give you speed. On 06.05.2009, at 16:30, Beatrice Tamburrino wrote: Hi, I am writing a little webserver for an extern application, this webserver should handle the incoming http request which kannel calls with the dlr-url given. Now, the question is, if kannel forwards the http request sequentiel, i won't need to take care of the multithreaded stuff.. well, I took a look at the source code but i wasn't able to find something.. Original-Nachricht Datum: Wed, 6 May 2009 16:23:54 +0200 Von: Andreas Fink af...@list.fink.org An: Beatrice Tamburrino beatrice.tamburr...@gmx.ch CC: devel Devel devel@kannel.org Betreff: Re: singlethreaded or multithreaded What do you mean by DLR request? Kannel asks the SMSC to report back. The SMSC will report whenever something is happening and kannel forwards it to http. On 06.05.2009, at 16:18, Beatrice Tamburrino wrote: hi, how does kannel send the dlr-requests? sequentiell? or pararell multithreaded?? xox bea -- Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01 -- Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a -- Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a -- Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01
Re: singlethreaded or multithreaded
it is in gwlib http.c/http.h and by the way, you can use this code to write your own custom HTTP server ;-) On 06.05.2009, at 17:28, Beatrice Tamburrino wrote: thx! I probably will do it multithreaded.. any idea where to find the sending process in the source code? Original-Nachricht Datum: Wed, 6 May 2009 17:15:49 +0200 Von: Andreas Fink af...@list.fink.org An: Beatrice Tamburrino beatrice.tamburr...@gmx.ch CC: devel Devel devel@kannel.org Betreff: Re: singlethreaded or multithreaded I think you should for sure be able to accept multiple simultaneous incoming connections as its in the nature of a webserver. If you process them sequentially or more than one in parallel is then a performance issue. Kannel for sure doesnt stop working until it got the answer from the webserver as its written asynchronously. So it can have multiple parallel requests to multiple servers (this happens especially during WAP use). I'm not 100% sure how it handles requests to the same server as there it can keep a connection open and reuse it (HTTP Keepalive) but it for sure would not hurt your software to be able to handle a few requests in parallel as it would give you speed. On 06.05.2009, at 16:30, Beatrice Tamburrino wrote: Hi, I am writing a little webserver for an extern application, this webserver should handle the incoming http request which kannel calls with the dlr-url given. Now, the question is, if kannel forwards the http request sequentiel, i won't need to take care of the multithreaded stuff.. well, I took a look at the source code but i wasn't able to find something.. Original-Nachricht Datum: Wed, 6 May 2009 16:23:54 +0200 Von: Andreas Fink af...@list.fink.org An: Beatrice Tamburrino beatrice.tamburr...@gmx.ch CC: devel Devel devel@kannel.org Betreff: Re: singlethreaded or multithreaded What do you mean by DLR request? Kannel asks the SMSC to report back. The SMSC will report whenever something is happening and kannel forwards it to http. On 06.05.2009, at 16:18, Beatrice Tamburrino wrote: hi, how does kannel send the dlr-requests? sequentiell? or pararell multithreaded?? xox bea -- Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01 -- Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a -- Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
Re: singlethreaded or multithreaded
Andreas Fink schrieb: I think you should for sure be able to accept multiple simultaneous incoming connections as its in the nature of a webserver. If you process them sequentially or more than one in parallel is then a performance issue. Kannel for sure doesnt stop working until it got the answer from the webserver as its written asynchronously. So it can have multiple parallel requests to multiple servers (this happens especially during WAP use). I'm not 100% sure how it handles requests to the same server as there it can keep a connection open and reuse it (HTTP Keepalive) but it for sure would not hurt your software to be able to handle a few requests in parallel as it would give you speed. I can shade some light here. The HTTP client layer in gwlib/http.[ch] works this way: We look for a connection to the target host in our connection pool. If we have one in the pool we grep it and use it, if we don't have one, we create a TCP connection to the host. As soon as the request/response transaction is finished, and we run in Keep-Alive mode (HTTP/1.1) we will put the connection back to the pool. Well, what does that mean? we create as man connections (there is no hard limit per host target), as the re-cycling of the connection is put back into the pool. This is a pretty hard way to hit the HTTP server. We get a lot of complains that we break HTTP servers by hitting it too hard ;) Stipe -- --- Kölner Landstrasse 419 40589 Düsseldorf, NRW, Germany tolj.org system architecture Kannel Software Foundation (KSF) http://www.tolj.org/ http://www.kannel.org/ mailto:st_{at}_tolj.org mailto:stolj_{at}_kannel.org ---
Re: singlethreaded or multithreaded
On Wed, 2009-05-06 at 17:52, Beatrice Tamburrino wrote: The webserver should be part of a big software engine which my company develops. we also use the apache server but for incoming traffic, we need a custom build one for overviewing the requests. anyway, its not a big deal to write a webserver, but I'm really interested on how the output-requests are done? maybe you have an idea? I wrote custom server/application in Perl. I'm thinking to rewrite it in C, but don't have time to do that. It's cheaper to by CPU/memory. And, yes, kannel send requests over http interface (GET method) in parallel, not sequentially. -- Kind regards, Milan -- Arvanta, IT Securityhttp://www.arvanta.net Please do not send me e-mail containing HTML code.
Re: singlethreaded or multithreaded
Stipe Tolj st 'at' tolj.org writes: The HTTP client layer in gwlib/http.[ch] works this way: We look for a connection to the target host in our connection pool. If we have one in the pool we grep it and use it, if we don't have one, we create a TCP connection to the host. As soon as the request/response transaction is finished, and we run in Keep-Alive mode (HTTP/1.1) we will put the connection back to the pool. Well, what does that mean? we create as man connections (there is no hard limit per host target), as the re-cycling of the connection is put back into the pool. This is a pretty hard way to hit the HTTP server. We get a lot of complains that we break HTTP servers by hitting it too hard ;) Actually, the parallelization achieved is quite very good, and adding the power of C and pthreads it allows a very good performance, seemingly. In my company, we use the tomcat java web application server, backed by a postgresql database. Once upon a time, we decided to ask for as many DLRs as operators/kannel could produce, and it ended up in breaking tomcat within a few years during a DLR peak time, because each DLR would produce a synchronous database request in our application. So I quickly redesigned that for a production/consumer FIFO queue optimized for fast production in our java application, with only one consumer thread performing the actual DLR processing involving the database query, and it is now entirely fine. In other words, the bottleneck was in our bad software design, and database performance, that the HTTP server itself (yet, it's written in pure java). In production, IIRC I have seen as many as hundreds of DLRs received from a single SMSC link per second (even if operators would never accept as many submitted SMS's per second as that, but that's a different story), an amount kannel was totally fine with (on a midprice dell xeon server several years old) - and also tomcat. -- Guillaume Cottenceau
Re: singlethreaded or multithreaded
Hi, Actualy I have been working a lot in that area recently, in wap. Kannel has a static thread structure, from beginning to end. The threads (22 for bearerbox, 18 for wapbox) serve to connect and move data between queues. The input/output character is single threaded in wapbox/bearerbox. I have implemended dynamic threads to the outgoing wap interface. Performance is not that much improved by it, if accessing from within the LAN, in fact threads will introduce some overhead due to thread manager and scheduling, and might run slightly slower. What threads do is make for a more robust software. Having introduced a 10 delay, as in real networks, between transmit and receive threads, wapbox can handle as many as 3 simultaneous users before timing out (30 delay). The threaded design can handle thousands of simultaneous users with the same baseline delay of 10 each. It is quite easy to find for yourself the smsbox character. Start top and watch the number of threads. Generate some load, and if the character is multithreaded, you will see threads increasing. Else it is sequential in character. BR, Nikos - Original Message - From: Guillaume Cottenceau g...@mnc.ch To: Stipe Tolj s...@tolj.org Cc: devel Devel devel@kannel.org Sent: Wednesday, May 06, 2009 7:28 PM Subject: Re: singlethreaded or multithreaded Stipe Tolj st 'at' tolj.org writes: The HTTP client layer in gwlib/http.[ch] works this way: We look for a connection to the target host in our connection pool. If we have one in the pool we grep it and use it, if we don't have one, we create a TCP connection to the host. As soon as the request/response transaction is finished, and we run in Keep-Alive mode (HTTP/1.1) we will put the connection back to the pool. Well, what does that mean? we create as man connections (there is no hard limit per host target), as the re-cycling of the connection is put back into the pool. This is a pretty hard way to hit the HTTP server. We get a lot of complains that we break HTTP servers by hitting it too hard ;) Actually, the parallelization achieved is quite very good, and adding the power of C and pthreads it allows a very good performance, seemingly. In my company, we use the tomcat java web application server, backed by a postgresql database. Once upon a time, we decided to ask for as many DLRs as operators/kannel could produce, and it ended up in breaking tomcat within a few years during a DLR peak time, because each DLR would produce a synchronous database request in our application. So I quickly redesigned that for a production/consumer FIFO queue optimized for fast production in our java application, with only one consumer thread performing the actual DLR processing involving the database query, and it is now entirely fine. In other words, the bottleneck was in our bad software design, and database performance, that the HTTP server itself (yet, it's written in pure java). In production, IIRC I have seen as many as hundreds of DLRs received from a single SMSC link per second (even if operators would never accept as many submitted SMS's per second as that, but that's a different story), an amount kannel was totally fine with (on a midprice dell xeon server several years old) - and also tomcat. -- Guillaume Cottenceau