Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

couchbase server not accessible after populating data

2 replies [Last post]
  • Login or register to post comments
Sun, 01/27/2013 - 00:21
sabithvm
Offline
Joined: 11/27/2012
Groups: None

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));
}

Top
  • Login or register to post comments
Mon, 01/28/2013 - 04:10
tgrall
Offline
Joined: 09/05/2012
Groups: None

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

Top
  • Login or register to post comments
Mon, 01/28/2013 - 07:20
sabithvm
Offline
Joined: 11/27/2012
Groups: None

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)

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker