netflix

java中级面试题

强颜欢笑 提交于 2019-11-29 03:29:13
1、Java中堆和栈有什么不同? 每个线程都有自己的栈内存,用于存储本地变量,方法参数和栈调用,一个线程中存储的变量对其它线程是不可见的。而堆是所有线程共享的一片公用内存区域。对象都在堆里创建,为了提升效率线程会从堆中弄一个缓存到自己的栈,如果多个线程使用该变量就可能引发问题,这时volatile 变量就可以发挥作用了,它要求线程从主存中读取变量的值。 堆:(对象) 引用类型的变量,其内存分配在堆上或者常量池(字符串常量、基本数据类型常量),需要通过new等方式来创建。 堆内存主要作用是存放运行时创建(new)的对象。 (主要用于存放对象,存取速度慢,可以运行时动态分配内存,生存期不需要提前确定) 栈:(基本数据类型变量、对象的引用变量) 基本数据类型的变量(int、short、long、byte、float、double、boolean、char等)以及对象的引用变量,其内存分配在栈上,变量出了作用域就会自动释放。 2、Spring的Scope有以下几种,通过@Scope注解来实现: (1)Singleton:一个Spring容器中只有一个Bean的实例,此为Spring的默认配置,全容器共享一个实例。 (2)Prototype:每次调用新建一个Bean实例。 (3)Request:Web项目中,给每一个 http request 新建一个Bean实例。 (4)Session

Eureka peers not synchronized

亡梦爱人 提交于 2019-11-29 02:33:37
I'm prototyping a set of Spring Cloud + Netflix OSS applications and have run into trouble with Eureka. In our setup, we have a Spring Cloud Config Server + Eureka Server, and then 2 modules that utilize that server component for bootstrapping and service discovery. The problem I run into is that if I spin up 2 instances of the Eureka Server and try to pair them (based on the Two Peer Aware Eureka Servers in the docs ) they don't synchronize with each other. See configs below and/or the code on GitHub . Essentially, Peer1 starts up and looks fine. Peer2 will startup and look fine, with both

Netflix video player in Chrome - how to seek?

我是研究僧i 提交于 2019-11-29 02:24:42
I have been unable to figure out how to do a video seek (automatically advance to a certain point in the video) in the Netflix video player running in Chrome. The currentTime property can be read but not set in the Netflix player, and when set, immediately triggers the error "Whoops! Something went wrong.". Other actions such as Play and Pause work quite well. For example, you can try the following: Log into Netflix (from Google Chrome) and go to the movie Armageddon . After the movie loads, pause it if it starts playing. Open the Chrome Developer Tools panel. Go to the Console tab. Paste the

SpringCloud之Zuul网关简介、映射vs过滤配置使用

五迷三道 提交于 2019-11-29 00:25:23
目的:    Zuul 路由网关 简 介及基本使用    Zuul 路由映射配置    Zuul 请求过滤配置 Zuul路由网关简介及基本使用 Zuul简介:   Zuul是从设备和网站到Netflix流应用程序后端的所有请求的 前门 。作为边缘服务应用程序,Zuul旨在实现动态路由,监控,弹性和安全性。它还可以根据需要将请求路由到多个合适的服务弹性收缩组。 Zuul官网地址: https://github.com/Netflix/zuul/wiki    Zuul使用一系列不同类型的过滤器,这些过滤器可帮助我们执行以下功能: 身份验证和安全性 - 识别每个资源的身份验证要求并拒绝不满足这些要求的请求。 洞察和监控 - 在边缘跟踪有意义的数据和统计数据,以便为我们提供准确的生产视图。 动态路由 - 根据需要动态地将请求路由到不同的后端群集。 压力测试 - 逐渐增加群集的流量以衡量性能。 Load Shedding - 为每种类型的请求分配容量并删除超过限制的请求。 静态响应处理 - 直接在边缘构建一些响应,而不是将它们转发到内部集群 多区域弹性 - 跨AWS区域路由请求,以使我们的ELB使用多样化,并使我们的优势更接近我们的成员。 基本使用(路由配置)    我们新建一个工程, microservice-zuul-3001 zuul也注册到eureka服务里,端口3001

importance of PCA or SVD in machine learning

对着背影说爱祢 提交于 2019-11-28 15:07:49
问题 All this time (specially in Netflix contest), I always come across this blog (or leaderboard forum) where they mention how by applying a simple SVD step on data helped them in reducing sparsity in data or in general improved the performance of their algorithm in hand. I am trying to think (since long time) but I am not able to guess why is it so. In general, the data in hand I get is very noisy (which is also the fun part of bigdata) and then I do know some basic feature scaling stuff like

spring-cloud with RestTemplate//Ribbon/Eureka - retry when server not available

戏子无情 提交于 2019-11-28 12:42:18
I managed to successfully get my RestTemplate client discover remote service using Eureka and forward calls to it using Ribbon as described in the documentation. Basically, it was just a matter of adding the following annotations of my Application class and let the magic of Spring-Boot do the rest: @Configuration @ComponentScan @EnableAutoConfiguration @EnableDiscoveryClient (PS: you noticed I'm using spring-cloud:1.0.0-SNAPSHOT-BUILD and not 1.0.0.M3 - but this doesn't seem to affect my problem). When two service instances are started, the rest-template client successfully load balance

springboot2.1.x版本报错总结

你离开我真会死。 提交于 2019-11-28 11:32:00
我使用的是springboot 2.1.7.RELEASE springcloud Greenwich.SR2 boot和cloud对应的版本号不能搞混,对应版本请参考 https://spring.io/projects/spring-cloud#overview 技术交流群 : 816227112 问题1 The bean 'eurekaRegistration', defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration$EurekaClientConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.class] and overriding is disabled. "C:\Program Files\Java\jdk1.8.0_192

熔断机制hystrix

倖福魔咒の 提交于 2019-11-28 08:04:10
一、问题产生 雪崩效应:是一种因服务提供者的不可用导致服务调用者的不可用,并将不可用逐渐放大的过程 正常情况下的服务 : 某一服务出现异常,拖垮整个服务链路,消耗整个线程队列,造成服务不可用,资源耗尽: 形成过程: 1)服务提供者不可用 a)硬件故障:硬件损坏造成的服务器主机宕机, 网络硬件故障造成的服务提供者的不可访问 b)程序Bug: c) 缓存击穿:缓存击穿一般发生在缓存应用重启, 所有缓存被清空时,以及短时间内大量缓存失效时. 大量的缓存不命中, 使请求直击后端,造成服务提供者超负荷运行,引起服务不可用 d)用户大量请求:在秒杀和大促开始前,如果准备不充分,用户发起大量请求也会造成服务提供者的不可用 2)重试加大流量 a)用户重试:在服务提供者不可用后, 用户由于忍受不了界面上长时间的等待,而不断刷新页面甚至提交表单 b)代码逻辑重试: 服务调用端的会存在大量服务异常后的重试逻辑 3)服务调用者不可用 a)同步等待造成的资源耗尽:当服务调用者使用同步调用 时, 会产生大量的等待线程占用系统资源. 一旦线程资源被耗尽,服务调用者提供的服务也将处于不可用状态, 于是服务雪崩效应产生了。 二、概念 服务熔断 : 一般是指软件系统中,由于某些原因使得服务出现了过载现象,为防止造成整个系统故障,从而采用的一种保护措施,所以很多地方把熔断亦称为过载保护

spring cloud netflix eureka高可用注册中心(找不到服务)

帅比萌擦擦* 提交于 2019-11-28 07:33:47
spring cloud netflix eureka高可用注册中心(找不到服务) 今天在学习spring cloud高可用注册中心时遇到了一个难缠的问题,而且困扰了我半天。根据官方文档和一些书籍搭建了一个注册中心,但是将集群内各个服务启动后报错了,注册中心集群内的各个服务都注册不上去,百度搜,无果。先上代码。 pom.xml <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency> application.yml spring: application: name: service-registry --- server: port: 8771 spring: profiles: peer1 eureka: instance: hostname: peer1 client: serviceUrl: defaultZone: http://peer2:8772/eureka/ --- server: port: 8772 spring: profiles: peer2 eureka: instance: hostname: peer2 client: