couchbase server not accessible after populating data
hi
i was trying to implement a proto to see if one of our usescase would work well with CB. After populating data in the below format, i started getting "Repeating failed XHR request.." whenever i try to access the data
for each trade, we would create a json document and then store the parent documents (1MB files) that was used to create the trade document in separate CB documents and update the trade document with the reference document Ids. i was converting the binary stream to UTF string and saving them in the reference documents (not sure if this is the right approach)
sample C# code is as below. What could be wrong ?
for (int nTrdIndex = 0; nTrdIndex < 100000; ++nTrdIndex)
{
Trade newTrade = new Trade
{
tradeId = "Trd"+ Guid.NewGuid().ToString(),
version = "1",
action= "New",
counterpartyId = "Cpyt" + Guid.NewGuid().ToString(),
tradeType = "IRSwap",
tradeSubType = "ZC",
notional = 5000000,
startDate = DateTime.Now,
endDate = DateTime.Now.AddYears(2)
};
string xmlText;
Type objectType = newTrade.GetType();
XmlSerializer xmlSerializer = new XmlSerializer(objectType);
MemoryStream memoryStream = new MemoryStream();
using (XmlTextWriter xmlTextWriter =
new XmlTextWriter(memoryStream, Encoding.UTF8)
{ Formatting = System.Xml.Formatting.Indented })
{
xmlSerializer.Serialize(xmlTextWriter, newTrade);
memoryStream = (MemoryStream)xmlTextWriter.BaseStream;
xmlText = new UTF8Encoding().GetString(memoryStream.ToArray());
memoryStream.Dispose();
}
newTrade.xml = xmlText;
string key = newTrade.tradeId + "?" + newTrade.version;
byte[] binaryStream = File.ReadAllBytes(".//testData.zip").ToArray();
newTrade.AssociatedDataList = new List();
AssociatedData qaObj = new AssociatedData()
{
ParentId = newTrade.tradeId,
BinaryStream = new UTF8Encoding().GetString(binaryStream),
Id = Guid.NewGuid().ToString(),
Type = "QA"
};
AssociatedData murexObj = new AssociatedData()
{
ParentId = newTrade.tradeId,
BinaryStream = new UTF8Encoding().GetString(binaryStream),
Id = Guid.NewGuid().ToString(),
Type = "Murex"
};
var result = CouchbaseManager.Instance.ExecuteStore(StoreMode.Add, qaObj.Id, Newtonsoft.Json.JsonConvert.SerializeObject(qaObj));
newTrade.AssociatedDataList.Add(qaObj.Id);
result = CouchbaseManager.Instance.ExecuteStore(StoreMode.Add, murexObj.Id, Newtonsoft.Json.JsonConvert.SerializeObject(murexObj));
newTrade.AssociatedDataList.Add(murexObj.Id);
newTrade.Id = Guid.NewGuid().ToString();
result = CouchbaseManager.Instance.ExecuteStore(StoreMode.Add, newTrade.Id, Newtonsoft.Json.JsonConvert.SerializeObject(newTrade));
}
below are the env details. iam running both client and server in the same laptop. and do note that once i click on documents from the web ui, the server becomes unresponsive. Also the reason for not saving the binary stream directly is because i need to update the parent id in the document that contains the binary stream
- Couchbase Server Version - running version 2.0.0 enterprise edition (build-1976)
- Client and Server Configuration - both running
Intel (R) Core i7 - 3517 CPU @ 1.90GHz
7.71 GB usable memory
- OS & Version - 64 Bit operating System (Windows 7 Ultimate)
- Any error log?
- from the client - None (not sure where to locate this) dont find a folder named C:\Program Files\Couchbase\Server\log
- from the server? - None (not sure where to locate this)
Hello,
Could you please give us the following information:
- Couchbase Server Version
- Client and Server Configuration
- OS & Version
- Any error log?
- from the client
- from the server?
What is the initial format of the document you want to store as binary?
If I understand correctly your code ( I am not familiar with C#) you have:
- a parent document that is JSON
- a child as reference.
Since Couchbase allows you to store any type of value you do not need to store the child in a JSON document you can simply store the binary itself. (default serialization from C#)
Regards
Tug
@tgrall