小编pio*_*est的帖子

Lazy <T>无异常缓存

是否System.Lazy<T>有无例外的缓存?或者懒惰的多线程初始化和缓存的另一个很好的解决方案?

我有以下程序(在这里小提琴):

using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
using System.Net;

namespace ConsoleApplication3
{
    public class Program
    {
        public class LightsaberProvider
        {
            private static int _firstTime = 1;

            public LightsaberProvider()
            {
                Console.WriteLine("LightsaberProvider ctor");
            }

            public string GetFor(string jedi)
            {
                Console.WriteLine("LightsaberProvider.GetFor jedi: {0}", jedi);

                Thread.Sleep(TimeSpan.FromSeconds(1));
                if (jedi == "2" && 1 == Interlocked.Exchange(ref _firstTime, 0))
                {
                    throw new Exception("Dark side happened...");
                }

                Thread.Sleep(TimeSpan.FromSeconds(1));
                return string.Format("Lightsaver for: {0}", jedi);
            }
        }

        public class LightsabersCache
        {
            private readonly …
Run Code Online (Sandbox Code Playgroud)

.net c# multithreading caching lazy-evaluation

9
推荐指数
4
解决办法
2191
查看次数

“nodetool compact”对DateTieredCompactionStrategy有什么作用?

nodetool compact 的文档说

此命令在使用 SizeTieredCompactionStrategy 和 DateTieredCompactionStrategy 的表上启动压缩过程。您可以指定用于压缩的键空间。

但是它对 DateTieredCompactionStrategy 有什么作用呢?

附带问题:什么是-s, --split-output参数?解释为:Use -s to not create a single big file。我很困惑 - 这不是目的nodetool compact吗?

cassandra nodetool datastax cassandra-2.0

6
推荐指数
1
解决办法
1608
查看次数

Azure WebJobs - 托管在哪里?它们作为长期运行的过程是否安全?

Azure WebSite Always OnAzure Web站点上"Always On"设置的含义我假设Azure WebJobs托管在IIS中并使用IIS资源(以及我们的网站资源).

此外,在定价页面:http://azure.microsoft.com/en-us/pricing/details/websites/有一个声明:

按需,按计划运行自定义可执行文件和/或脚本,或作为Web站点实例中的后台任务连续运行.连续WebJobs执行需要Always On.计划的WebJobs需要Azure Scheduler Free或Standard.

因此我认为这是真的.实际上Azure WebJobs托管在Azure网站的IIS中.注意:WebJobs可以连续且长时间运行.

然而,令我担心的是,执行长时间运行的进程/后台进程通常被视为反模式:

那么Microsoft Azure提出了一些看似反模式的东西吗?附加问题:然后将Quartz.NET作为连续任务运行并进行"免费"简单后台任务调度会是一个好主意吗?

c# iis azure azure-web-sites azure-webjobs

5
推荐指数
1
解决办法
1837
查看次数

随机请求被中止:无法创建 SSL/TLS 安全通道。返回代码=MessageAltered

在大约千分之一的 HTTPS 请求中,会抛出以下异常:

System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
    at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
    at System.Net.WebClient.DownloadString(Uri address)
Run Code Online (Sandbox Code Playgroud)

System.Net的日志如下所示:

2016-09-20 15:10:17.1031 | INFO | 72 | System.Net | [2688] Associating HttpWebRequest#37618637 with ServicePoint#28841767
2016-09-20 15:10:17.1031 | INFO | 72 | System.Net | [2688] Associating Connection#16407032 with HttpWebRequest#37618637
2016-09-20 15:10:17.1031 | INFO | 72 | System.Net.Sockets | [2688] Socket#42531032 - Created connection from x.x.x.x:12345 to y.y.y.y:443.
2016-09-20 15:10:17.1031 | INFO | 72 | System.Net | [2688] …
Run Code Online (Sandbox Code Playgroud)

.net c# webrequest httpwebrequest tls1.2

5
推荐指数
1
解决办法
2541
查看次数

Cassandra nodetool 修复究竟是做什么的?

http://docs.datastax.com/en/cassandra/2.0/cassandra/operations/ops_repair_nodes_c.html我知道

nodetool repair 命令修复给定数据范围内所有副本的不一致。

  • 但它如何解决不一致的问题?它写的是使用默克尔树 - 但这是为了比较而不是为了修复“损坏的”数据。
  • 数据如何被“破坏”?尽管硬盘驱动器出现故障,有什么常见情况吗?

抛开问题:它是压实驱逐墓碑,对吧?那么比gc_grace 秒更频繁地运行nodetool repair 的要求只是为了确保所有数据都传播到适当的副本?这不应该是通常的场景吗?

cassandra

3
推荐指数
1
解决办法
3829
查看次数

什么是Cassandra的本地运输请求?

查看Datastax OpsCenter中的节点详细信息时:

在此输入图像描述

我们可以看到有34903422个"本地传输请求",但是有1072个被阻止.

  • 有人可以解释什么是本机传输请求吗?与突变有关的是什么?
  • 他们被封锁是正常的,这是什么意思?

BTW.我们还可以看到有93个突变被丢弃,我们知道这意味着什么:什么是cassandra中的突变?.

cassandra opscenter datastax

2
推荐指数
1
解决办法
5924
查看次数