由买买提看人间百态

topics

全部话题 - 话题: instances
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
c*****t
发帖数: 1879
1
Actually, I am a big fan of static / singleton codes :)
Basically, I think of static functions as utility functions.
It is easy to wrap a static function inside a instance function. Never
forget that an instance function is only meaningful either when it
involves an instance variable or when one intends to override it. Yet,
since one usually prefer composition over inheritance, so creating an
instance function only when instance variables are involved. Besides
static function is much faster t
t*******e
发帖数: 684
2
It depends on how specific each application instance is. If the
dispredencies are a bit high, it is less risky and costly to maintain
multiple instances. My company has been through the cycle from multiple
application instances to a single instance and now back to multiple
instances again. Don't be lured by some blueprint books, there are concepts
presented largly for marketing purpose, without much real world value.
Single sign on is totally irrelevant to your single app/multiple app debate. Al
g*****g
发帖数: 34805
3
This is correct, but not neccesarily the most efficient.
I would do it this way. And if create SpecialSinglton is
a heavy function, you can consider using Future. Check
the memoizer pattern.
instance = instanceMap.get(i);
if (instance == null) {
instance = new SpecialSingleton(i);
temp = instanceMap.putIfAbsent(i, instance);
if(temp != null) return temp;
}
return instance;
c*********e
发帖数: 16335
4
来自主题: Java版 - Java的主要的应用是什么?
flash做出来的东西,看起来还是比较fancy, user-friendly的。java的缺点就是界面
很丑陋,这个在android上完全显示出来。用户买的就是界面,界面后面的程序什么的
,用户才不关心。
現在网络上的很多video,还是用的.flv模式。这点上,flash的策略是讨好用户,至于
技术方面,没那么关心。
这其实还是归结到了communication 的3种instance,亚里士多德关于rhetoric的论述,
人和人之间的交流,有3种模式
1.pedant's instance
2.advertiser's instance
3.entertainer's instance
到了现在,西方还是遵循着这3个instance.不得不说亚里士多德对白人世界影响深远。
q**q
发帖数: 266
5
【 以下文字转载自 BuildingWeb 讨论区 】
发信人: qiiq (qiiq), 信区: BuildingWeb
标 题: how does AWS's auto scale work?
发信站: BBS 未名空间站 (Tue Apr 22 12:54:57 2014, 美东)
Suppose I launched an AWS instance, deployed my application (i.e., a Java
WAR). When a single instance is incapable of handling the heavy traffic, is
the AWS going to automatically duplicate the application to another instance
and redirect some traffic to the second instance? Here, I consider an "
instance" as a "server", but I'm not sure whether I'm c... 阅读全帖
b***y
发帖数: 2799
6
☆─────────────────────────────────────☆
jejune (孑孓) 于 (Mon Sep 8 20:04:56 2008) 提到:
网上搜到的代码大都类似于这样:
static T& getInstance(){
if (instance== null)
{
instance= new T();
}
}
}
return instance;
}
这样如果没有gc还得自己删掉,多线程的时候还得考虑加锁。
为什么不这样
static T& getInstance(){
static T instance;
return instance;
}
☆─────────────────────────────────────☆
xiangcjc (alwayswonde
l**b
发帖数: 64
7
来自主题: Programming版 - 小白弱问一个AWS EC2 outage的问题
本人歪打正着转行web developer,边工作边学的阶段。请教各位一个AWS EC2 outage
的问题,求大家指点,有说的外行的地方,请大家不要见笑。
现在网站用的是AWS EC2,大概日访问量200-400,去年是medium的instance,今年一月
份客户因为预算的原因,要求改到了small,一直到三月初都很正常。最近两周,网站
down了三次,第一次是server reboot但是MySQL没有autostart,改好了。第二down掉
之后,负责server的人给重新clone到了一个新的small instance。第三次down,给重
新换回了medium instance。
现在客户很不情愿换到medium的instance,因为觉得网站流量不大。请问大家,可能是
什么原因导致的这个问题频繁的发生呢?是网站被攻击了么?如果是,如何能排查一下
原因?如果就是instance的大小的原因导致的,我该怎么向客户解释从一月到三月初都
没问题,这两个星期出问题呢?
从cloudwatch看到的,outage时候CPU达到了100%。虽然EC2 有CPU steal的问题... 阅读全帖
p*****2
发帖数: 21240
8
来自主题: Programming版 - haskell怎么调试好?
大牛看看为什么hs推断不出来类型?
data Tree a = EmptyTree | Node a (Tree a) (Tree a) deriving (Show)
test = show EmptyTree
No instance for (Show a0) arising from a use of ???show???
The type variable ???a0??? is ambiguous
Note: there are several potential instances:
instance Show a => Show (Tree a)
-- Defined at /Users/gzhao/Documents/workspace/hsTest2/src/Tree.hs:3
:62
instance Show Double -- Defined in ???GHC.Float???
instance Show Float -- Defined in ???GHC.Float???
..... 阅读全帖
b***i
发帖数: 3043
9
来自主题: Programming版 - ThreadLocal可以这样用吗?
public static ThreadLocal instance;
public static void setHDC(Integer i){
instance=new ThreadLocal();
instance.set(i);
System.out.println("Program "+"in "+ GThreadLib.get()+" setting ="+i
);
}
public static Integer getHDC(){
Integer h=instance.get();
System.out.println("Program "+" in "+GThreadLib.get()+" getting ="+h
);
}
还是必须 public static final ThreadLocal instance=new
ThreadLocal();
我好像在前一种实... 阅读全帖
S*******s
发帖数: 13043
10
来自主题: Programming版 - 请教高手一个C++问题
template< class T1, class T2 >
class NamedSingleton{
protected:
NamedSingleton(){};
public:
static T1& GetInstance(const T2& name){
static std::map instances;
typename std::map::iterator ite=instances.find(name);
if(ite==instances.end()){
instances.insert(std::pair(name,T1(name)));
ite=instances.find(name);
}
return (ite->second);
}
private:
};
class A:public NamedSingleton阅读全帖
t******r
发帖数: 28
11
来自主题: Computation版 - c++选择题求解
1. What is Visual C++?
a.It's a program used for starting other programs.
b.It's a program that you use to create other programs.
c.It's a program for browsing the Web.
d.It's a multimedia program that teaches you how to program.
2.What is the name of the process by which Visual C++ converts your C++
code to a program the computer can understand?
a.Compile.
b.Run.
c.Debug.
d.Build.
3.What do you call the container that stores all the files you write and
all the files Visual C++ writes to create ... 阅读全帖
s******r
发帖数: 5309
12
来自主题: Military版 - 美新川粉暂时还没反应过来
New York files suit against President Trump, alleging his charity engaged in
‘illegal conduct’
2:26
How Donald Trump directed millions to his foundation
Donald Trump directed millions of dollars to his tax-exempt foundation. Here
's how. (Video: Peter Stevenson, Lee Powell/Photo: Jabin Botsford/The
Washington Post)
By David A. Fahrenthold
June 14 at 11:19 AM
Email the author
The New York attorney general on Thursday filed suit against President Trump
and his three eldest children alleging “persi... 阅读全帖
s******n
发帖数: 518
13
来自主题: Military版 - 美国生物实验室泄露 (转载)
【 以下文字转载自 History 讨论区 】
发信人: shaodian (有熊), 信区: History
标 题: 美国生物实验室泄露
发信站: BBS 未名空间站 (Sun Mar 22 15:25:05 2020, 美东)
Google翻译一次只能3900字符。
https://www.usatoday.com/story/news/2015/05/28/biolabs-pathogens-location-
incidents/26587505/
Investigation reveals hundreds of accidents, safety violations and near
misses put people at risk
Alison Young and Nick Penzenstadler, USA TODAY
Vials of bioterror bacteria have gone missing. Lab mice infected with deadly
viruses have escaped, and wild rodents have b... 阅读全帖
c*****g
发帖数: 21627
14
来自主题: USANews版 - 疣太高盛迫害前员工
Michael Lewis: Did Goldman Sachs Overstep in Criminally Charging Its Ex-
Programmer?
A month after ace programmer Sergey Aleynikov left Goldman Sachs, he was
arrested. Exactly what he’d done neither the F.B.I., which interrogated him
, nor the jury, which convicted him a year later, seemed to understand. But
Goldman had accused him of stealing computer code, and the 41-year-old
father of three was sentenced to eight years in federal prison.
Investigating Aleynikov’s case, Michael Lewis holds a s... 阅读全帖
l****z
发帖数: 29846
15
Census ‘faked’ 2012 election jobs report
By John Crudele
November 18, 2013 | 8:06pm
Census ‘faked’ 2012 election jobs report
Census ‘Fake’gate goes back even further
House probes Census over ‘fake’ results
Is it possible to kill quantitative-easing painlessly?
Sorry kids, but this debt's on us
The ugly business of stealing money meant for vets
In the home stretch of the 2012 presidential campaign, from August to
September, the unemployment rate fell sharply — raising eyebrows from Wall
Street to... 阅读全帖
w*********s
发帖数: 2136
16
来自主题: WorldNews版 - 小布什回忆录被指是抄编大杂汇

George Bush Book 'Decision Points' Lifted From Advisers' Books
Huffington Post 11-12-10
When Crown Publishing inked a deal with George W. Bush for his memoirs, the
publisher knew it wasn't getting Faulkner. But the book, at least, promises
"gripping, never-before-heard detail" about the former president's key
decisions, offering to bring readers "aboard Air Force One on 9/11, in the
hours after America's most devastating attack since Pearl Harbor; at the
head of the table in the Situ... 阅读全帖
u****n
发帖数: 7521
17
How America Can Rise Again
Is America going to hell? After a year of economic calamity that many fear has sent us into irreversible decline, the author finds reassurance in the peculiarly American cycle of crisis and renewal, and in the continuing strength of the forces that have made the country great: our university system, our receptiveness to immigration, our culture of innovation. In most significant ways, the U.S. remains the envy of the world. But here’s the alarming problem: our governin... 阅读全帖
a****n
发帖数: 1887
18
来自主题: JobHunting版 - 关于singleton 的面试题
double check 主要是为了减少多线程情况下进入critical section的次数
static Singleton* getInstance()
{
if (instance == null)
{
lock()
if (instance == null)
instance = new Singleton();
unlock()
}
return instance;
}
a****r
发帖数: 87
19
来自主题: JobHunting版 - 问一个关于c++的很傻的问题,多谢
like xunhuan119 said. instances allocated on heap have a global scope, and
instances allocated on stack have local scope. When the instances are out of
scope, their dtor will clean up the allocated memory. The global scoped
instances will never out of scope.
H********g
发帖数: 1107
20
你创建instance的时候,可以选择,terminate的instance的时候,不要删除ebs
volume,
这样你下个instance就可以把这个volume挂载上。
不过一般推荐开个新的ebs volume,挂载instance上放数据。
H********g
发帖数: 1107
21
你创建instance的时候,可以选择,terminate的instance的时候,不要删除ebs
volume,
这样你下个instance就可以把这个volume挂载上。
不过一般推荐开个新的ebs volume,挂载instance上放数据。
F****n
发帖数: 438
22
你回贴前,为什么不google一下呢?
我们只是在ABC总部前抗议,不必谨小慎微的。
希望在城里工作的同学们午饭时间都过来支持。
http://www.nyclu.org/content/know-your-rights-demonstrating-new
Know Your Rights: Demonstrating in New York City
New Yorkers have the right to engage in peaceful, protest activity on public
sidewalks, in public parks and on public streets in New York City. This
includes the right to distribute handbills or leaflets; the right to hold
press conferences, demonstrations and rallies; and the right to march on
public sidewalks and in pu... 阅读全帖
R****G
发帖数: 138
r****e
发帖数: 3373
24
来,我给你贴一个。老头讲究起来真讲究,啰嗦起来真啰嗦,逗的时候真逗,恶的时候
真恶。
Playboy Interview: Vladimir Nabokov
By ALVIN TOFFLER • PLAYBOY • JANUARY 1964
Playboy: With the American publication of Lolita in 1958, your fame and
fortune mushroomed almost overnight from high repute among the literary
cognoscenti—which you had enjoyed for more than 30 years—to both acclaim
and abuse as the world-renowned author of a sensational best seller. In the
aftermath of this cause célèbre, do you ever regret having written Lolita?... 阅读全帖
C***l
发帖数: 2625
25
来自主题: PhotoGear版 - 最近万佛确实空洞了点

That's wise. Read this: http://www.slate.com/id/2295603/
"for an extra hour of commuting time, you would need to be compensated with
a massive 40 percent increase in salary to make it worthwhile."
This week, researchers at Umea University in Sweden released a startling
finding: Couples in which one partner commutes for longer than 45 minutes
are 40 percent likelier to divorce. The Swedes could not say why. Perhaps
long-distance commuters tend to be poorer or less educated, both conditions
that ... 阅读全帖
G****e
发帖数: 11198
26
来自主题: WaterWorld版 - Is Law School a Losing Game? zz
http://www.nytimes.com/2011/01/09/education/edlife/09ap-t.html?
January 8, 2011
Is Law School a Losing Game?
By DAVID SEGAL
IF there is ever a class in how to remain calm while trapped beneath $250,
000 in loans, Michael Wallerstein ought to teach it.
Here he is, sitting one afternoon at a restaurant on the Upper East Side of
Manhattan, a tall, sandy-haired, 27-year-old radiating a kind of surfer-dude
serenity. His secret, if that’s the right word, is to pretty much ignore
all the calls and lett... 阅读全帖
G****e
发帖数: 11198
27
来自主题: WaterWorld版 - The Darker Side Of God
The Darker Side Of God
If you ask Christians to describe their quasi-chosen god of worship,
you’ll often hear such descriptors as “wonderful” and “loving.” This
choice of selective designation seems commonplace within the Christian
community. In fact, most churches ignore the Old Testament all together so
that the members feel comfortable propagating this view. Fueled by such
blatant omission, this lengthy chapter will fill the void by offering a look
at the volume of horrendous acts perfo... 阅读全帖
g*******1
发帖数: 8758
28
☆─────────────────────────────────────☆
alex919 (不晓得叫撒子) 于 (Tue Feb 24 21:59:23 2009) 提到:
信仰=相信+敬仰
首先你相信某人,事,物,
敬仰大家都知道
后面省略一万字信仰的力量之类的。。。。
宗教是不是一种信仰(A),是,因为宗教相信某位神(上帝,佛。。。)得存在
无神论是不是一种信仰,是,因为无神论不相信某位神(上帝,佛。。。)存在
等价代换后:无神论是不是一种信仰,是,因为无神论相信某位神(上帝,佛。。。)
不存在
宗教 ,无神论是 信仰的sub class,继承了信仰的各项属性和方法(什么属性什么方法
不在讨论之列),
我党是无神论 的instance
基督教等等 是 宗教 的instance
由于内存资源有限(人类)各instance都想以独占模式运行,后果大家都知道了,
由于独占模式会烧毁存储单元,出现保护模式,instance 在较为限定的内存块下运行
,避免烧毁存储单硬件,(美国不让GCD运行,中国不让其他宗教运行)
。。。。。。
。。。。。。
继续略。。。
楼下请拍砖
☆─
G****e
发帖数: 11198
29
来自主题: Belief版 - The Darker Side Of God (转载)
【 以下文字转载自 WaterWorld 讨论区 】
发信人: GoBlue (Wolverines), 信区: WaterWorld
标 题: The Darker Side Of God
发信站: BBS 未名空间站 (Sat Jul 12 13:10:33 2014, 美东)
The Darker Side Of God
If you ask Christians to describe their quasi-chosen god of worship,
you’ll often hear such descriptors as “wonderful” and “loving.” This
choice of selective designation seems commonplace within the Christian
community. In fact, most churches ignore the Old Testament all together so
that the members feel comfortable propagatin... 阅读全帖
Y**u
发帖数: 5466
30
来自主题: Wisdom版 - [合集] 对话守则
☆─────────────────────────────────────☆
SeeU (See you) 于 (Mon Dec 19 16:28:55 2011, 美东) 提到:
哈维尔等在布拉格“公民论坛”制定的对话守则∶
1. 对话的目的是寻求真理,不是为了斗争。
2. 不做人身攻击。
3. 保持主题。
4. 辩论时要用证据。
5. 不要坚持错误不改。
6. 要分清对话与只准自己讲话的区别。
7. 对话要有记录。(按∶匿名也要负责。)
8. 尽量理解对方。
RIP: Vaclav Havel, Oct. 5, 1936-Dec. 18, 2011
☆─────────────────────────────────────☆
waterer (快义恩仇之灌水山寨王) 于 (Mon Dec 19 17:11:22 2011, 美东) 提到:
色大师的对话守则就是,
1 对老子就利就出头,对老子无利就王八缩头。
2 老子不喜欢的就告他PA,但老子喜欢的人PA老子就装他妈的看不见。
3 叉乘才是真理,真理就是叉乘。
4 狗肯定要继续吃X,但一定要对外宣称不再吃了。... 阅读全帖
x*r
发帖数: 11073
31
Social Science:
The Benefits of Multilingualism
Jared Diamond
Geography Department, University of California Los Angeles, Los Angeles, CA
90095-1524, USA.
E-mail: j******[email protected]
Multilingualism—the ability to understand and speak several languages—is
exceptional in the United States but common elsewhere, especially in small-
scale traditional societies. For instance, once while I was camped with some
New Guinea Highlanders conversing simultaneously in several local languages
, I asked ea... 阅读全帖
c********1
发帖数: 421
32
来自主题: BuildingWeb版 - 问一个关于AWS的设置问题
RDS最低一档是免费的,但好像RDS需要至少一个独立的instance
由于web layer已经占用了instance,所以RDS就需要新开一个instance
这个instance本身不是免费的
s**********o
发帖数: 14359
33
明白了,ORACLE->一个DB ENGINE 多个INSTANCE-》一个INSTANCE只有一个DB
SQL SERVER ->一个SERVER可以有多个DB ENGINE-》一个DB ENGINE 只有一个INSTANCE-
》一个INSTANCE可以有多个DB
c*****t
发帖数: 1879
34
来自主题: Java版 - 发现 synchronized 的一个问题
ffdt. Of course it is not a design flaw. In fact, it would be a design
flaw if they do the way you said :)
Synchronization on class variables/functions (static ones), are really
things synchronizing "global" things of all instances of the objects.
For example, you can write an id counter to count how many instances
have been created and give an unique id to each instance.
For each instance, they have synchronized functions that, for example,
change the state of the object per se, such adding/d
s*******e
发帖数: 174
35
方法1:
public class Singleton
{
private static Singleton INSTANCE = null;
private Singleton() {}
public static synchronized Singleton getInstance()
{
if(INSTANCE == null)
INSTANCE = new Singleton();
return INSTANCE;
}
}
1 和3 还是有区别的吧,3 没用 Synchronized keyword.
嗯,我已经找到了
c*****t
发帖数: 1879
36
Two issues.
1. As magicfat has pointed out, you have a race condition. Normally,
you need to check-and-check-again to verify the value. That is:
instance = map.get (i);
if (instance == null)
{
synchronized (...)
{
instance = map.get (i); // very important!
if (instance == null)
{
// instantiation
}
}
}
2. Note that, synchronized map itself requires locking! This is a major
issue. This is oxymoron because you wasted a lot of code and essentially
still
M***0
发帖数: 1180
37
各位做这方面的,你们公司用的是以下哪种方式,优点缺点各是什么?
1 让所有tenants用同一个application instance
例如application的名字叫MyApp(root url), 有N个客户A,B,C,etc
部署以后的URL是
对A公司用户 Http://hostname/MyApp/../A/../..
对B公司用户 Http://hostname/MyApp/../B/../..
对C公司用户 Http://hostname/MyApp/../C/../..
在runtime的时候用各种interceptor来决定用哪个bean implementation哪个jdbc
connection等等
2 给每个tenant deploy一个ear(can be in the same cluster or different
clusters),在compile之后package之前,用ant等工具修改bean implementation(i.e
inject哪个class), web.xml,application.xml, persistence.xm... 阅读全帖
z****e
发帖数: 54598
38
来自主题: Java版 - 关于singleton
关于double check,有一个优化版
这个优化版的问题可不是那么简单的
public static Singleton getInstance()
{
if (instance == null)
{
synchronized(Singleton.class) {
Singleton inst = instance;
if (inst == null)
{
synchronized(Singleton.class) {
inst = new Singleton();
}
instance = inst;
}
}
}
return instance;
}
o**2
发帖数: 168
39
来自主题: Java版 - 工作中遇到的并行处理问题
你说的这个并不是thread特定的问题,当程序进入constructor时,JVM就已经把这个
instance建立起来了,然后的问题就是这个instance的internal state,也就是它的
instance变量,有可能在一个或多个constructor中有变化,而这些变化是不应该暴露
给外面的世界,相当于transaction的内部阶段。
我的代码没有这个问题,Predictor的constructor不改变instance的internal state。
p*****3
发帖数: 488
40
http://venturebeat.com/2011/08/16/linkedin-node/
说的是15台物理机器,每台跑15个virtual instance, 一共是225个instances减少到了
4个instances,还没说这4个instances在几台物理机器上,没准算4台物理机. 怀疑是
nodejs处理IO/Service call的能力太强了还是他们原来是设计太烂了... 就能有那么
显著的效果?
N***m
发帖数: 4460
41
来自主题: Programming版 - hibernate又遇到新问题了
documentation里面说如何做CompositeUserType
public class MoneyType implements CompositeUserType {
public String[] getPropertyNames() {
return new String[] { "amount", "currency" };
}

public Type[] getPropertyTypes() {
return new Type[] { BigDecimalType.INSTANCE, CurrencyType.INSTANCE };
}
。。。
我的MyEclipse为啥对BigDecimalType.INSTANCE报错?BigDecimalType提示下面没有
INSTANCE这一项。
h*****g
发帖数: 312
42
来自主题: Programming版 - C++ online Test 2题
class Base{
public:
Base();
virtual ~Base();
};
class Derived: protected Base{
public:
virtual ~Derived();
};
int _tmain(int argc, _TCHAR* argv[])
{
Base *pd = new Derived;
getchar();
return 0;
}
Referring to the sample code above, which one of the following statements is
true?
A.
A constructor needs to be added to Derived class.
B.
The pointer returned by new cannot be type cast from Derived* to Base*.
C.
A pointer to a Base class cannot point to an instance of a Derived class.
D.
Derived class... 阅读全帖
S*******s
发帖数: 13043
43
来自主题: Programming版 - python: how to import a decorator?
I got an error if I want to run test.py:
@singleton
NameError: name 'singleton' is not defined
if I combine the two files, it would be fine.
what is right way to import decorator?
#in module Singleton.py
def singleton(theClass):
""" decorator for a class to make a singleton out of it """
classInstances = {}
def getInstance(*args, **kwargs):
""" creating or just return the one and only class instance.
The singleton depends on the parameters used in __init__ """... 阅读全帖
m********5
发帖数: 17667
44
This is dynamic language. `Person` is NOT a C++ or java like `class`. `
Person` is just a name in global scope referring to an instance of `type`.
In another word `Person` is nothing but a key in the global name dictionary.
During interpretor exiting, as @hatemaths pointing out, when __del__ get
called, there is no guarantee any referred global name still exists (
deleting order is unpredictable). In this case `Person` in the global scope
has already being destroyed. But in the local scope it st... 阅读全帖
t**********s
发帖数: 930
45
来自主题: Programming版 - 怎么把一个Map放到queue里? (转载)
每个instance 只访问end point 一次,取得数据.
所以每个Instance自己没有RTT的均值,因为只有一次访问.
我想要的是不同的Instance所有的不同的RTT的均值.
RTT来自哪个Instance无所谓.
所以hash table里应该只是 ts--->RTT.
每加入一个新entry,就用它 的ts做基准,比它老规定值的entry都剔除去.
q*c
发帖数: 9453
46
那就算了 - 那我们就上单机, 不断电, 只看看 perf.
等我把下面几个 job run 上然后给你开机器去。 先弄个 large 开发, 等你整好了我
们上 16 core, 然后开放, 愿意测的就上。
牛屄机器配置如下:
M3 instances feature high frequency Intel Xeon E5-2670 (Sandy Bridge or Ivy
Bridge) processors. These instances offer SSD-based instance storage for
fast instance store I/O performance
2000M bps.
基本符合你的要求了!
h******b
发帖数: 6055
47
来自主题: Programming版 - 小白弱问一个AWS EC2 outage的问题
这么牛?
我现在是一个micro instance。 还没开始marketing,基本上没有流量。
能否在CPU/内存达到一定threshold以后自动变成small/medium/large? 硬盘不变,
只需要变内存和CPU。或者多加几个instance也可以。
这个也太强悍了,以前我有过一个Alexa排名两万五的网站。 一到event就卡的不行。
这玩艺完全是自动的?
我的网页和数据库还是只需要维持在一个盘上吗? 如果我需要让多个instance保持一
致就很烦了。 如果一个客户传数据进来是如何让多个instance一起拥有这个数据的?
难道是多个instanceshare一个volume那就太爽了。
z****e
发帖数: 54598
48
来自主题: Programming版 - 小白弱问一个AWS EC2 outage的问题
你的persistence放哪里就挪哪里过去
如果你只有mysql,那就挪mysql过去
但是如果你还有其他的persistence,比如hbase
那就都挪过去,ec2的instance设计是
用来放一些服务器软件的,逻辑处理主要放在ec2上
其他cloud都是算一个instance,所以也分不了这么细
只能修改instance的各种参数,增加缩小酱紫
然后cloud根据访问流量自动调整instance的数量或者规模
这是cloud的最大的优势,对比一般的vps或者自己买机器而言
scale up/out很容易,自己撰机器受限于硬件性能
a*****e
发帖数: 1700
49
来自主题: Programming版 - oop还是跟fp是对立的
我觉得你要说的是:
func1(Object obj)
func2(Object obj)
这种写法,你在 func1 和 func2 的 body 里面只知道对象是 Object,从而不能谈论
更多。
换成 OO 的方式, obj->func1() obj->func2(),只需要知道 Object class 里面有
func1 和 func2 两个成员函数,而不需要知道 obj 具体是 Object class 还是它的
sub class。通过 sub class 来 overload method 可以实现更多功能。
这是你的意思,对不对?
这种 OO 里面的做法换成用 Haskell:
class ObjectClass a where
func1 :: a -> ...
func2 :: a -> ...
type ObjectType1 = ...
type ObjectType2 = ...
instance ObjectClass ObjectType1 where
func1 = ...
func2 = ...
instance ObjectC... 阅读全帖
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)