私はIISホストWCFサービスを1台のサーバーで実行し、Windowsサービスを別のサーバーで実行しています。 Windowsサービスはスレーブとして機能し、MS Sync Frameworkを使用してIISホストのWCFサービスに接続することにより、各サーバーのデータベースを同期させます。MS Sync FrameworkとIISホストWCFサービスとの2mbエントリの同期テーブルには10分かかります
私は同期されているテーブルの1つにファイルの内容を保存していますが、エントリは少し大きくなる可能性があります(1エントリあたり10MB)。私の問題は、これらのエントリを同期しようとすると、同期に時間がかかることです。
同期中のテーブル:
[Id] [int] IDENTITY(1,1) NOT NULL,
[Client] [uniqueidentifier] NOT NULL,
[Date] [datetime] NOT NULL,
[Content] [nvarchar](max) NOT NULL,
私は次のようにさまざまなコンテンツサイズの1つのエントリとの同期を計時しました。
- 500キロバイト - 1分20秒
- 1メガバイト -
- 1,5mb 3分 - 6分30秒
- 2メガバイト - 9分50秒
(Visual Studioでデバッグするときにタイミングがほぼ同じでした
なぜこのように長い時間がかかるのですか?
WCFサービスの設定:
<configuration>
<system.web>
<httpRuntime maxRequestLength="2147483647" />
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding closeTimeout="00:20:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Windowsサービスの設定:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ISyncServiceContract" closeTimeout="00:20:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:60000/SyncService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISyncServiceContract" contract="SyncServiceReference.ISyncServiceContract" name="BasicHttpBinding_ISyncServiceContract"/>
</client>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
私はあなたの意見を見ますが、信じがたいと感じます。時間の経過がデータの転送にかかる時間に起因する場合、サービスとデータベースの両方を同じマシン上でローカルにデバッグする場合、同じ時間がかかりません。たとえ2 MBが200 MBまで膨らんだとしても、同じマシンとの間で転送するのに10分かかることはありません。 – Avilan
@Aviian、同じディスクから読み書きしている場合は、 –