Git Product home page Git Product logo

blockoffendinguser's Introduction

Problem Description

Lets say a bot or a bad user is sending too much of HTTP traffic to your site. He is sending many http requests through some scripts or programs that eats up your server resources and bandwidth.

Solution

The solution is being inspired from Java's own garbage collection. There are three LRUs, young, old and permanent LRU. Any request comes to your site, extract the user ip and user identifier and pass that to this library. Library will keep track of all new users in the young LRU. If the user is coming too often, then he will be promoted to yound generation and if he is coming really too often which is not possible by a normal human to come to your site, then he will be promoted to permanent LRU.

The best way to use this library is, develop a filter which extracts user ip and user identification and passes to TrackUser.trackUserIp(String ip, String userId) method. For any incoming user also check, if he is already blocked by using TrackUser.isThisAOffendingUser(String ip, String userId).

The threshold of how many requests user should do to promote him to Old generation from Young generation or exactly how many requests you should receive to promote him from old generation to permanent generation can be configured.

Check the test cases to know more about it.

blockoffendinguser's People

Contributors

shamikm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.