mercredi 28 mai 2014

Java - DDoS résistants du réseau application conception - Stack Overflow


Okay, for my application I'm trying to decide on an architecture that's as DDoS resistant as possible. Obviously it will never be perfect but I'd like protection against simple attacks.


There's a few that I've thought of so far:


1) Single thread per connection.


This method seems to have unbelievable scalability problems, and with a tonne of connections, having too many threads seems like it would be a scheduling nightmare for the OS.


2) 2 threads. first thread will accept connections and append them to a list, the second thread loops through the list (with the proper synchro here) and checks if there's anything in the InputStream. Upon finding something, read a line. Any of the actual work will be done, including the reply, in a new event thread. The new thread is just passed the line that is read.


This method seems to have even bigger problems. It appears as though a simple cat /dev/urandom | telnet server port would lock it down.


3) This is similar to #2, but only read a single byte from each connection at each iteration, and processing it as a string when I get to a newline byte.


This seems like my best option so far, but it means that if the attack initiates a lot of connections and sends input on all of them, it could slow the loop down considerably.


Are there any other potential architectures that might be better suited for the job?



Okay, for my application I'm trying to decide on an architecture that's as DDoS resistant as possible. Obviously it will never be perfect but I'd like protection against simple attacks.


There's a few that I've thought of so far:


1) Single thread per connection.


This method seems to have unbelievable scalability problems, and with a tonne of connections, having too many threads seems like it would be a scheduling nightmare for the OS.


2) 2 threads. first thread will accept connections and append them to a list, the second thread loops through the list (with the proper synchro here) and checks if there's anything in the InputStream. Upon finding something, read a line. Any of the actual work will be done, including the reply, in a new event thread. The new thread is just passed the line that is read.


This method seems to have even bigger problems. It appears as though a simple cat /dev/urandom | telnet server port would lock it down.


3) This is similar to #2, but only read a single byte from each connection at each iteration, and processing it as a string when I get to a newline byte.


This seems like my best option so far, but it means that if the attack initiates a lot of connections and sends input on all of them, it could slow the loop down considerably.


Are there any other potential architectures that might be better suited for the job?


0 commentaires:

Enregistrer un commentaire