09-07-2016
Writing a REST server to run on FreeBSD -- how to structure for concurrency?
Hi All,
I want to write a domain specific REST/HTTP server to run on FreeBSD. I have control over both the server side and the
primary client intended to consume the service.
My question is:
how do you think it should be designed to support multiple connections, given:
- It will run on a modern x86 chip (I7 6700K) which has 4 cores, each running two threads.
- REST transactions are short-lived, request/response, which are basically HTTP requests (GET, POST, DELETE).
Is fork() too costly for each connection?
Is kqueue the wrong tool, given that the connections are not really long-lived and do not consist of repeated updates/polling?
Should I use a thread approach where I have the master, and then create a new thread for each connection and then terminate the thread after the response is sent back?
I am really at a loss as to what the most effective approach to take is. While it may never be used, I'd at least like to design it to be efficient and capable of supporting as many concurrent connections as possible!
Thanks for any suggestions.
(
I want to write it for multiple reasons: to learn, to challenge myself, to build something minimalistic, because the sun rises, etc. I realize I could just grab and go with an existing web server but I don't want to do that.)
Last edited by rbatte1; 09-14-2016 at 06:10 AM..
Reason: Converted to formatted number-list
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Ok, I've been shopping around and I've seen some nice one's, but they are either too expensive or they are not 64-bit; I want to be prepared for the future at the right price (under $3,000 with a decent configuration)! :D
Where can I find a good 64-bit desktop or workstation that will run the... (0 Replies)
Discussion started by: Mr. Nice Guy
0 Replies
2. Shell Programming and Scripting
Hi All,
I am new user of shell scripting has come up with a problem. that I have a directory structure like :
Home
|
|--------A
| |----trunk
| |-------A_0_1/
| |
| |-------A_0_2/
|
|--------B
| ... (6 Replies)
Discussion started by: bhaskar_m
6 Replies
3. Shell Programming and Scripting
Hi,
I have a directory structure like the one given below
root\a\b1
root\a\b2
root\b\b1
root\b\b2
.
.
.
root\j\b1
root\j\b2
Now, there are a txt files in each dir and subdir, there is a root.txt
I have to write a script where in i have to run a command called "genrb <filename>"... (6 Replies)
Discussion started by: vikramsinghnegi
6 Replies
4. UNIX for Advanced & Expert Users
The reason I ask is because the einstein client in the freash ports is not the current one with boinc. No new work is being assigned. They sugested or asked if I could run boinc 6.10.17 linux in emulation and if so, I would be able to crunch einstein data.
so, anyone done the linux emulation of... (0 Replies)
Discussion started by: droolin
0 Replies
5. Shell Programming and Scripting
Hi,
I am a novice and require help once again.
I have a over 200 file all called index.jsp placed in different directories
The following Sed command gives me the data of all included jsp files in index.jsp
sed -n -e 's/^.*page="\(*\).*$/\1/p' index.jsp
How can I run the above... (6 Replies)
Discussion started by: rajkdutta
6 Replies
6. Shell Programming and Scripting
Hello All,
I have got a dev server and a production server will call it as D server and P server.
I have a dir structure in my D server and i need to create the same dir structure in P server also using a shell script.
If i do a find . in my D server, i am getting an o/p like :-
.
./vio... (9 Replies)
Discussion started by: Renjesh
9 Replies
7. UNIX for Dummies Questions & Answers
Hi All,
I want to copy the dir/subdir structure from SERVER-A to SERVER-B without copying all the files in each dir.
Is it possible using SCP / SFTP command?
For example,
SERVER-A has following two dir/subdirectories and files under each subdir.
... (1 Reply)
Discussion started by: Hangman2
1 Replies
8. Shell Programming and Scripting
I have a script called script.sh that has the following in it.
cat /home/auto/script.sh
#!/bin/bash
ARGA=$1
if ; then
echo "${ARGA}:Confirmed"
else
echo "${ARGA}:Unconfirmed"
fi
I need a way to run this script, and then, after script has confirmed the... (9 Replies)
Discussion started by: SkySmart
9 Replies
9. Shell Programming and Scripting
Hi,
Brand new to these forums, and I hope that someone can help me out.
I'm trying to run the following command in UNIX
java -jar GenomeAnalysisTK.jar -T SplitSamFile -dt NONE -R reference.fa -I my.bam --outputRoot /my/path/SampleFiles/Sample_
It executes the SplitSamFile from GATK, but I... (3 Replies)
Discussion started by: Wixaros
3 Replies
10. Shell Programming and Scripting
Hello gurus,
I produce a number of .loc files in parallel depending on number of .csv in the folder
for file in *csv
do
./process.sh $file > $file.loc &
done
then I want to compile all the output from the previous step into a single masterlocfile and then perform the rest of the steps... (2 Replies)
Discussion started by: senhia83
2 Replies
fair(7) BSD Miscellaneous Information Manual fair(7)
NAME
fair -- simple TCP load balancing service
DESCRIPTION
fair is a load balancer for TCP connections. It can be used to distribute incoming connections for SMTP, HTTP or any other TCP service to
multiple hosts, distributing the load as evenly as possible.
fair consists of two daemons. The carrousel is the front-end; it keeps track of back-end hosts and their status, and forwards incoming con-
nections to the back-ends in such a way that the load is distributed fairly. The transponder runs on the back-end hosts, it registers with
the carrousel and sends it status information. The TCP connections forwarded by the carrousel are not sent to the transponder daemons but
are sent directly to the desired service running on the back-end host. Both daemons share a single configuration file.
EXAMPLES
The following example shows how to set up fair to service HTTP connections and to distribute them over back-ends in the 192.168.1.0/24 sub-
net.
The configuration file /etc/fair.conf contains the following:
WorkerService = http
BalancerService = http
AllowUDP = ^192.168.1.[0-9]+$
On www.example.com, the front-end server receiving the incoming HTTP connections, just run:
carrousel
On each of the back-ends run:
transponder www.example.com
SEE ALSO
carrousel(8), transponder(8), fair.conf(5)
Debian GNU/Linux June 1, 2019 Debian GNU/Linux