首页 \ 问答 \ 以最少的停机时间部署Java webapps的最佳做法?(Best practices for deploying Java webapps with minimal downtime?)

以最少的停机时间部署Java webapps的最佳做法?(Best practices for deploying Java webapps with minimal downtime?)

当部署大型Java webapp(> 100 MB .war)时,我目前正在使用以下部署过程:

  • 应用程序.war文件在开发机器上本地扩展。
  • 扩展的应用程序是rsync:从开发机器到实时环境。
  • rsync之后重新启动实时环境中的应用服务器。 此步骤不是严格需要的,但是我发现在部署时重新启动应用程序服务器会因为频繁的加载而避免使用“java.lang.OutOfMemoryError:PermGen space”。

关于这种方法的好东西:

  • rsync将从开发机器发送到实时环境的数据量最小化。 上传整个.war文件需要十分钟,而rsync需要几秒钟的时间。

关于这种方法的坏事:

  • rsync正在运行时,由于文件被更新,应用程序上下文将重新启动。 理想情况下,重新启动应该在rsync完成后发生,而不是当它仍在运行时。
  • 应用服务器重新启动会导致大约两分钟的停机时间。

我想找到具有以下属性的部署过程:

  • 部署过程中的最短停机时间。
  • 上传数据时间最短。
  • 如果部署过程是应用程序服务器特定的,则应用服务器必须是开源的。

题:

  • 根据规定的要求,什么是最佳的部署过程?

When deploying a large Java webapp (>100 MB .war) I'm currently use the following deployment process:

  • The application .war file is expanded locally on the development machine.
  • The expanded application is rsync:ed from the development machine to the live environment.
  • The app server in the live environment is restarted after the rsync. This step is not strictly needed, but I've found that restarting the application server on deployment avoids "java.lang.OutOfMemoryError: PermGen space" due to frequent class loading.

Good things about this approach:

  • The rsync minimizes the amount of data sent from the development machine to the live environment. Uploading the entire .war file takes over ten minutes, whereas an rsync takes a couple of seconds.

Bad things about this approach:

  • While the rsync is running the application context is restarted since the files are updated. Ideally the restart should happen after the rsync is complete, not when it is still running.
  • The app server restart causes roughly two minutes of downtime.

I'd like to find a deployment process with the following properties:

  • Minimal downtime during deployment process.
  • Minimal time spent uploading the data.
  • If the deployment process is app server specific, then the app server must be open-source.

Question:

  • Given the stated requirements, what is the optimal deployment process?

原文:https://stackoverflow.com/questions/1640333
更新时间:2024-05-03 18:05

最满意答案

那就是LINQ的Select - ie

var newSequence = originalSequence.Select(x => {translation});

要么

var newSequence = from x in originalSequence
                  select {translation};

That is LINQ's Select - i.e.

var newSequence = originalSequence.Select(x => {translation});

or

var newSequence = from x in originalSequence
                  select {translation};

相关问答

更多
  • 那就是LINQ的Select - ie var newSequence = originalSequence.Select(x => {translation}); 要么 var newSequence = from x in originalSequence select {translation}; That is LINQ's Select - i.e. var newSequence = originalSequence.Select(x => {transl ...
  • 如果您有一个定义可选参数的C#库,那么您可以使用您在问题中使用的语法。 为了快速显示这种情况,我将以下C#代码编译为库: using System; namespace Demo { public class MyClass { public static void Foo(int first, string second = "foo", string third = "bar") { } } } 您可以引用它并从F#中使用它,如下所示: open Demo MyClass.Foo(1 ...
  • 发送POST时,发送给服务器的Content-Type确实是服务器期望的内容类型非常重要。 您可以使用curl中的-trace选项轻松验证发送的内容: curl -v --trace - -X POST http://localhost -F Key=abcd -F media=@"image.txt" 当你运行它时,你会发现前几行的某个地方: 00b0: 63 6f 6e 74 69 6e 75 65 0d 0a 43 6f 6e 74 65 6e continue..Conten 00c0: 74 2 ...
  • 语法是 sorteddictionary.[int] 那么它就像你期望的那样工作 The syntax is sorteddictionary.[int] then it works as you would expect
  • 使用PSeq模块: open Microsoft.FSharp.Collections let newlist = oldlist |> PSeq.map myComplexFunction |> PSeq.toList Use the PSeq module: open Microsoft.FSharp.Collections let newlist = oldlist |> PSeq.map myComplexFunction |> PSeq ...
  • 在F#外部访问时, Map称为FSharpMap 。 您可以使用var来避免笨拙的类型名称(在您的示例中)。 但是,大多数F#特定类型实现了跨语言边界良好的接口。 例如, Map实现了IDictionary<_,_> 。 在将在F#之外使用的API中,建议的解决方案是公开这些接口。 查看组件设计指南以获取更多建议。 话虽如此,您可以毫无困难地使用C#中的FSharpMap 。 它看起来很奇怪,并不适合惯用的C#代码。 Map is called FSharpMap when accessed outside ...
  • 这完全没有经过测试,但我认为这一点是对的。 它的本质是你需要使用Async.AwaitTask将Task转换为Async然后其余部分非常明显。 let doRecursiveAsyncThing input = async { use r = XmlReader.Create(new StringReader(input), new XmlReaderSettings(Async = true )) let loop x = async { let! noteType = r ...
  • 你让你的功能更好。 这正是柯里化的情况,这是一种技术,用于以“一个一个”参数的方式来表达您的功能,可以这么说。 在数学上,这样的函数只需要一个参数,并返回另一个采用第二个参数的函数。 像这样的东西: let curriedPowInt = fun n -> fun x -> powInt (x, n) 这种定义函数的方式是司空见惯的。 事实上,ML语言(其中F#是一种语言)的本质非常重要,因为它有一种特殊的语法: let curriedPowInt n x = powInt (x, n) 看看我如何在一 ...
  • 我猜你真的写了 [] let Main(args) = let arg = [@"C:\Temp\bin"; @"C:\temp\xml"] arg|> List.map(fun (s) -> printfn "%s" s) 并且一个EntryPoint方法(例如Main() )必须返回一个int。 I'm guessing you actually wrote [] let Main(args) = let arg = [@" ...
  • F#没有意识到input.split的结果可以和map函数一起使用,因为它是一个字符串数组 List.map适用于list s,因此F#实现的结果不能与List.map一起使用。 请改用Array.map (适用于数组)。 F# not realizing the result of input.split can be used with the map function as it's a string array List.map works on lists, so F# realizes the ...

相关文章

更多

最新问答

更多
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • 电脑高中毕业学习去哪里培训
  • 电脑系统专业就业状况如何啊?
  • IEnumerable linq表达式(IEnumerable linq expressions)
  • 如何在Spring测试中连接依赖关系(How to wire dependencies in Spring tests)
  • Solr可以在没有Lucene的情况下运行吗?(Can Solr run without Lucene?)
  • 如何保证Task在当前线程上同步运行?(How to guarantee that a Task runs synchronously on the current thread?)
  • 在保持每列的类的同时向数据框添加行(Adding row to data frame while maintaining the class of each column)
  • 的?(The ? marks in emacs/haskell and ghc mode)
  • 一个线程可以调用SuspendThread传递自己的线程ID吗?(Can a thread call SuspendThread passing its own thread ID?)
  • 延迟socket.io响应,并“警告 - websocket连接无效”(Delayed socket.io response, and “warn - websocket connection invalid”)
  • 悬停时的图像转换(Image transition on hover)
  • IIS 7.5仅显示homecontroller(IIS 7.5 only shows homecontroller)
  • 没有JavaScript的复选框“关闭”值(Checkbox 'off' value without JavaScript)
  • java分布式框架有哪些
  • Python:填写表单并点击按钮确认[关闭](Python: fill out a form and confirm with a button click [closed])
  • PHP将文件链接到根文件目录(PHP Linking Files to Root File Directory)
  • 我如何删除ListView中的项目?(How I can remove a item in my ListView?)
  • 您是否必须为TFS(云)中的每个BUG创建一个TASK以跟踪时间?(Do you have to create a TASK for every BUG in TFS (Cloud) to track time?)
  • typoscript TMENU ATagParams小写(typoscript TMENU ATagParams lowercase)
  • 武陟会计培训类的学校哪个好点?
  • 从链接中删除文本修饰(Remove text decoration from links)