ELB ---> Nginx servers ---> one Varnish Server ---> Return if cache is found. The problem I met is that /pop_service/{channel_id}/points will get burst hit by users. Thus, the load of the server will increase dramatically. The solution to this problem is that ELB(Amazon Load Balancing Server) send matched requests to Nginx servers. upstream backend { hash $request_uri consistent; server 104.207.149.81; server 45.63.83.59; } server { listen 80 default_server; listen [::]:80 default_server; location / { proxy_pass http://backend; } } Nginx servers with the above configuration have the ability to route requests based on request URI. AKA, the same URI gets redirects to the same server. The config file of varnish is the following: vcl 4.0; import directors; backend server1 { .host = "104.207.149.81"; .port = "80"; .probe = { .url = "/"; .timeout = 1s
What is functional programming? a programming paradigm (worldview, mindset) it's kind of a way of looking at a world in terms of what the world is composed of. Imperative follow my commands do this, then that Object-Oriented keep state to yourself send/receive messages Declarative this is what I want I don't care how you do it e.g. SQL Functional sort of a sub-paradigm of Declarative What is functional programming? one simple idea. pure functions (only input in, only output out) Not pure: var name = "Saint Petersburg"; function greet() { console.log("Hello, " + name + "!"); } greet(); // Hello, Saint Petersburg! Pure: function greet(name) { return "Hello, " + name + "!"; } greet("Saint Petersburg"); // Hello, Saint Petersburg! Why functional programming? - more predictable, safer - easier to test/debug all you need to do to test pure functions is to pass in the input and
Comments
Post a Comment