Skip to content
Snippets Groups Projects
Commit ba389032 authored by Martin Karsten's avatar Martin Karsten
Browse files

- webserver acceptor fibres not in background

- add connection counter to webserver
parent c4381bc3
No related branches found
No related tags found
No related merge requests found
......@@ -121,13 +121,15 @@ static void usage(const char* prog) {
}
// fibre counting
static volatile size_t connections = 0;
static volatile size_t connectionFibres = 0;
static void exitHandler(int sig) {
if (sig == SIGINT) cout << endl;
cout << "threads: " << threadCount << " cluster size: " << clusterSize << " listeners: " << listenerCount << " event scopes: " << scopeCount;
if (affinityFlag) cout << " affinity";
cout << endl << "fibres: " << connectionFibres << endl;
cout << endl << "connections: " << connections << endl;
cout << "fibres: " << connectionFibres << endl;
exit(0);
}
......@@ -326,6 +328,7 @@ static int create_socket(bool singleAccept = false) {
static void handler_loop(void* arg) {
for (;;) {
__atomic_add_fetch(&connections, 1, __ATOMIC_RELAXED);
while (connHandler(arg));
arg = CurrGarage().park();
}
......@@ -441,9 +444,9 @@ static void scopemain() {
// set poller thread affinity to group of cores
CPU_SET(cpu, &clustercpus);
if (((t % clusterSize) == clusterSize-1) || (t == threadCount-1)) { // end of cluster or end of threads
// cout << "cluster "<< cidx << " affinity";
for (int j = 0; j < CPU_SETSIZE; j++) if (CPU_ISSET(j, &clustercpus)) cout << ' ' << j;
cout << endl;
// cout << "cluster " << cidx << " affinity: ";
// for (int j = 0; j < CPU_SETSIZE; j++) if (CPU_ISSET(j, &clustercpus)) cout << ' ' << j;
// cout << endl;
SYSCALL(pthread_setaffinity_np(cluster[cidx]->getPoller().getSysID(), sizeof(clustercpus), &clustercpus));
CPU_ZERO(&clustercpus);
cidx += 1;
......@@ -473,7 +476,7 @@ static void scopemain() {
for (unsigned int c = 0; c < clusterCount; c += 1) {
if (listenerCount) {
for (unsigned int i = 0; i < listenerCount; i += 1) {
Fibre* f = new Fibre(acceptor, (void*)servFD, true);
Fibre* f = new Fibre(acceptor, (void*)servFD);
#if defined __LIBFIBRE__
f->setPriority(topPriority);
#endif
......
......@@ -30,7 +30,7 @@
//#define TESTING_POLLER_FIBRES 1 // vs. per-cluster poller pthread
//#define TESTING_POLLER_IDLEWAIT 1 // vs. wake up poller thread anytime
//#define TESTING_POLLER_IDLETIMEDWAIT 10000 // vs. wait indefinitely for idle (usecs)
//#define TESTING_POLLER_IDLETIMEDWAIT 1000 // vs. wait indefinitely for idle (usecs)
#define TESTING_BULK_RESUME 1 // vs. individual resume
#define TESTING_LAZY_FD_REGISTRATION 1 // vs. eager registration after fd creation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment