Configuring message limit in openfire - openfire

I understand that the default size for the message is 1MB.
Is there a way to re-configure the limit.
Any help on this problem will be appreciated.
Thanks

You need to set the "xmpp.parser.buffer.size" property in Openfire (in byte) .
The default value is indeed 1MB.
(GIT code):
private static final String MAX_PROPERTY_NAME = "xmpp.parser.buffer.size";
maxBufferSize = JiveGlobals.getIntProperty(MAX_PROPERTY_NAME, 1048576);

Related

Is it possible to pass to lettuce redis library MasterSlave connection only slaves uris?

my aim is to add only slaves URIs, because master is not available in my case. But lettuce library returns
io.lettuce.core.RedisException: Master is currently unknown: [RedisMasterSlaveNode [redisURI=RedisURI [host='127.0.0.1', port=6382], role=SLAVE], RedisMasterSlaveNode [redisURI=RedisURI [host='127.0.0.1', port=6381], role=SLAVE]]
So the question is: Is it possible so avoid this exception somehow? Maybe configuration. Thank you in advance
UPDATE: Forgot to say that after borrowing object from pool I set connection.readFrom(ReadFrom.SLAVE) before running commands.
GenericObjectPoolConfig config = fromRedisConfig(properties);
List<RedisURI> nodes = new ArrayList<>(properties.getUrl().length);
for (String url : properties.getUrl()) {
nodes.add(RedisURI.create(url));
}
return ConnectionPoolSupport.createGenericObjectPool(
() -> MasterSlave.connect(redisClient, new ByteArrayCodec(), nodes), config);
The problem was that I tried to set data, which is possible only with master node. So there is no problem with MasterSlave. Get data works perfectly

Using Redis as Cache and C# client

I'm new to Redis and trying to figure out a simple way to use Redis as a local cache for my C# app. I've downloaded and ran the redis-server from https://github.com/MSOpenTech/redis/releases
I can successfully store a key value and retrieve it as follows:
var redisManager = new PooledRedisClientManager("localhost:6379");
using (var redis = redisManager.GetClient())
{
redis.Set("mykey_1", 15, TimeSpan.FromSeconds(3600));
// get typed value from cache
int valueFromCache = redis.Get<int>("mykey_1"); // must be =
}
I want to limit the amount of memory Redis uses on my server and I also want redis to automatically purge values when memory fills. I tried the maxmemory command but in the redus-cli program maxmemory is not found.
Will Redus automatically purge old values for me? (I assume not) and if not, is there a way that I can make the default behavior of redis do that with the Set method I'm using below?
If I'm heading down the wrong path, please let me know.
The answer to your question is described here: What does Redis do when it runs out of memory?
Basically, you set the maxmemory from the config file, and not from the redis-cli. You can also specify a maxmemory-policy, which is a set of procedures that redis executes when it runs out of the specified memory. According to that config file, there are a total of 6 policies that Redis is using when it runs out of memory:
volatile-lru -> remove the key with an expire set using an LRU algorithm
allkeys-lru -> remove any key according to the LRU algorithm
volatile-random -> remove a random key with an expire set
allkeys-random -> remove a random key, any key
volatile-ttl -> remove the key with the nearest expire time (minor TTL)
noeviction -> don't expire at all, just return an error on write operations
You can set those behaviours using the maxmemory-policy directive that you find in the LIMITS section of redis.conf file (above the maxmemory directive).
So, you can set an expire time to every key that you store in Redis (a large expire time) and also set a volatile-ttl policy. In that way, when Redis runs out of memory, the key with the smallest TTL (which is also the oldest one) is removed, according to the policy that you've set.

Setting MaxPageSize for EmbeddableDocumentStore

Seems that setting the Configuration for MaxPageSize inside the progrram does not work.
I know that it is bad practice, but i want to retrieve all distinct artists inside a Music Database collection and store it in a GUI Combo for selection and don't like to loop through bunch of 128 documents. The system is used standalone, so the performance impact isthe sameas a select * from a sql db.
i do this in my code:
_store = new EmbeddableDocumentStore
{
Configuration = new RavenConfiguration()
{
DataDirectory = #"Database\MusicDatabase\",
RunInMemory = false,
MaxPageSize = 300000
}
};
_store.Initialize();
But i still get only 128 documents returned.
Tried to add a key to my App config file and also added a web.config file with Raven/MaxPageSize, but it seems to be ignored.
Any idea?
thanks,
Helmut
MaxPageSize controls the max limit. And raising it is generally a bad idea.
If you don't specify how many items you want, however, we'll default to 128.

Yii: APC Cache throwing error of Servers not being configured

I have configured APC Cache for YII application but when I put a variable in cache, I get the following error for line 222:
APC Cache Error
http://i.stack.imgur.com/qu2tI.jpg
Following is my config/main.php entry for APC Cache:
'cache'=>array(
'class'=>'system.caching.CApcCache',
'servers'=>array(
array('host'=>'localhost','port'=>11211,'weight'=>60),
array('host'=>'localhost','port'=>11212,'weight'=>40),
),
),
Following is the code that I use to put data in cache:
public function getReligion(){
$lstofvals=Yii::app()->cache->get('RELIGION');
if ($lstofvals===false){
Yii::log('Loading Religion Data from List of Values.');
$lstofvals=$this->PopulateLSTValsData('RELIGION');
Yii::app()->cache->set('RELIGION', $lstofvals);
}
return $lstofvals;
}
I can see the output of apc.php in form of graphs and all other details.
Any help would much appreciated.
Please also confirm if my strategy to store the base data in cache is correct. I am new to Yii and found out about MemCache and APC Cache to be good candidates for such requirements.
Many thanks,
Faisal
Remove the entire servers array from your config file. APC isnt distributed. Servers are used for memcache as far as I know

Is it possible to set the fetch size for NHibernate?

When retrieving rows from an oracle database using ODP.NET, I can specify the FetchSize parameter, which is the number of bytes that will be retrieved in one round-trip to the database.
Is it possible to set a FetchSize (or equivalent) for NHibernate? If so, how is this done?
If not, is there a default size that it retrieves?
Thanks!
Subclass NHibernate.Driver.OracleDataClientDriver and override CreateCommand:
public override IDbCommand CreateCommand()
{
var command = (OracleCommand)base.CreateCommand();
command.FetchSize = desiredValue;
return command;
}
For completeness, you can also set this in the registry or in the machine.config, web.config, or app.config:
http://download.oracle.com/docs/html/E10927_01/featConfig.htm