Use memcached and not memcache in Joomla - joomla

My host has memcached and i want to configure it right. Last try i used memcache and my host update servers and missed to activate memcache and site went down. They reply that memcache is old and will soon not to be supported. So now i try to use memcached
But i be so confused all guide´s/how to talk about memcache not memcached?
In configuration file they say change:
public $caching = '2';
public $cache_handler = 'memcache';
Should this not to be memcached?
public $memcache_persist = '1';
public $memcache_compress = '0';
public $memcache_server_host = 'localhost';
public $memcache_server_port = '11211';
public $memcached_persist = '1';
public $memcached_compress = '0';
public $memcached_server_host = 'localhost';
public $memcached_server_port = '11211';
public $redis_persist = '1';
Should i change memcache or memcahed to right port and server host?
Regards

Memcache and Memcached are indeed two different things (though they do use some similar underlying architecture at the server level).
It is true that Memcache (no d) is an older thing and is officially not supported on PHP 7, while Memcached (with the d) is still actively maintained and supported on current PHP versions.
So, if you are intending to use Memcached (with the d), first log into your Joomla backend and see if the option is even available in the global config (the available handler list is dynamic based on what your server has installed and enabled). If you don't even see Memcached in that list, make sure you have all prerequisites set up (that should just be having PHP's ext/memcached installed and enabled). Then, you can safely change the $cache_handler option to 'memcached'.

Related

Repoint legacy app to new oracle home hierarchy

I am working on 2 virtual machines to test legacy application functionality on new platforms, with an OS & DB upgrade. The application that is being tested on the new client (Win7Prox64) was written in VB6. (It's pretty old!) When the application launches, it opens a form that allows users to login.
The old DB it connected to was 11G on Server2003SP2 32bit box and the app ran on a 32bit XP client. (The new VM for the new server for test is 2008R2x64).
The legacy app has the the following declared: ("frmLogin.frm")
(The app checks the registry for the location of tnsnames by assigning the correct directory paths to these Const's)
Private Const MODULE_NAME = "frmLogin"
Private Const REG_APP_KEY = "Software\ORACLE\HOME"
Private Const REG_APP_PATH = "Oracle_Home"
Private Const REG_ALL_HOMES = "Software\Oracle\ALL_HOMES"
Private Const REG_LAST_HOME = "LAST_HOME"
Private Const REG_MYAPP_KEY = "Software\company\myapp"
Private Const MYAPP_APP_KEY = "Database Host Name"
I assume I have to change these constants to the new hierarchy found with 11GR2 to make it work correctly, how do I check and update these? I'm not sure it's as easy as just changing the directories above, but I could be wrong.
Any tips welcome.
EDIT: I notice 11GR2 on Win7 64 registry entries are alot different to XP 32bit with 11G. Both in layout and content. LAST_HOME for example doesn't seem to exist on Win7, any advice?
I hard coded a reference to the location of tnsnames.ora into the app, and I know that it runs (and seems to run well) on the new 64bit client, but I cannot hardcode it for each and every client machine it will reside on, so need to re-point the directories correctly.
You have to go through every registry key in HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_***, since there are possibly multiple installations on one system.
Go to HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE in the registry, then check every sub key if it starts with KEY_. (pick the first if you don't care, if you do, go through every one)
In those keys you will find:
The TNS_ADMIN, the deviating location where the tnsnames.ora will be saved;
The ORACLE_HOME where you need to append network\admin where the tnsnames.ora will generally be found.

Symfony2 Slow Initialization Time

I have Symfony2 running on an Ubuntu Server 12.04 (64-bit) VM (VirtualBox). The host is a MacBook pro. For some reason I am getting really long request times in development mode (app_dev.php). I know its slower in dev mode, but I'm talking 5-7 seconds per request (sometimes even slower). On my Mac I get request times of 200ms or so in development mode.
After looking at my timeline in the Symfony2 profiler, I noticed that ~95% of the request time is "initialization time". What is this? What are some reasons it could be so slow?
This issue only applies to Symfony2 in dev mode, not any other sites I'm running on the VM, and not even to Symfony2 in production mode.
I saw this (http://stackoverflow.com/questions/11162429/whats-included-in-the-initialization-time-in-the-symfony2-web-profiler), but it doesn't seem to answer my questions.
I had 5-30 sec responses from Symfony2 by default. Now it's ~500ms in dev environment.
Then I modified the following things in php.ini:
set realpath_cache_size = 4M (or more)
disabled XDebug completely (test with phpinfo)
realpath_cache_ttl=7200
enabled and set OPcache (or APC) correctly
restarted Apache in order to have php.ini reloaded
And voilá, responses went under 2 secs in dev mode!
Before: 6779 ms
After: 1587 ms
Symfony2 reads classes from thousands of files and that's a slow process. When using a small PHP realpath cache, file paths need to be resolved one by one every time a new request is made in the dev environment if they are not in PHP's realpath cache. The realpath cache is too small by default for Symfony2. In prod this is not a problem of course.
Cache metadata:
Caching the metadata (e.g. mappings) is also very important for further performance boost:
doctrine:
orm:
entity_managers:
default:
metadata_cache_driver: apc
query_cache_driver: apc
result_cache_driver: apc
You need to enable APCu for this. It's APC without bytecode cache, as OPCache already does opcode caching. OPCache is built in since PHP 5.5.
---- After: 467 ms ----
(in prod environment the same response is ~80 ms)
Please note, this is project uses 30+ bundles and has tens of thousands of lines of code, almost hundred own services, so 0.5s is quite good on a local Windows environment using just a few simple optimizations.
I figured out the cause of the problem (and its not Symfony2). For some reason on the ubuntu VM, the modification times on certain files are incorrect (ie in the future, etc). When symfony2 checks these times using filemtime() against its registry, it determines that the cache is not longer fresh and it rebuilds the whole thing. I haven't been able to figure out why it is doing that yet.
I also needed to disable xdebug (v2.2.21) to debug apache2 max timeout loading on my macbook. It was installed using macports:
sudo port install php54-xdebug.
With xdebug enabled, every page run out max loading time, with a fatal error exceeding max timeout message dispatched. When disabled, everything just loads fine in a reasonable expected time. I came to this using MAMP, no xdebug enabled by default, and apache2 just works fast as usual. I may change for another debugger, that's a pitty, because xdebug worked fine before.
Config:
MacOSX 10.6.8
macports 2.1.3
Apache 2.2.24
php 5.4
We have the same problem.
Here we have 10 second and more for every request.
I see if I remove following lines in bootstrap.php.cache all times return in normal state (298 ms).
foreach ($meta as $resource) {
if (!$resource->isFresh($time)) {
return false;
}
}
It's possible that we have wrong modifications times, but we don't know how to fix. Somebody know a solution?
As said at https://stackoverflow.com/a/12967229/6108843 the reason of such behavior might be Ubuntu VM settings. You should to sync date and time between host and guest OS as explained at https://superuser.com/questions/463106/virtualbox-how-to-sync-host-and-guest-time.
File modification date changes to host's value when you upload file to VM via FTP. So that's why filemtime() returns wrong value.
You can move APP/var/cache в /dev/shm/YourAppName/var/cache. But it's good to have built container in local files too for IDE autocomplete and code validation. In app/AppKernel.php:
public function getCacheDir()
{
return $this->getVarOrShmDir('cache/' . $this->getEnvironment());
}
public function getLogDir()
{
return $this->getVarOrShmDir('logs');
}
private function getVarOrShmDir($dir)
{
$result = dirname(__DIR__) . '/var/' . $dir;
if (
in_array($this->environment, ['dev', 'test'], true) &&
empty($_GET['warmup']) && // to force using real directory add ?warmup=1 to URL
is_dir($result) && // first time create real directory, later use shm
file_exists('/bin/mount') && shell_exec('mount | grep vboxsf') // only for VirtualBox
) {
$result = '/dev/shm/' . 'YourAppName' . '/' . $dir . '/' . $this->getEnvironment();
}
return $result;
}
I disabled xdebug and it resulted in a decrease loading time from 17s (yea..) to 0.5s.
I had problems as well with slow page loads in development, which can extremely frustrating when you're tweaking CSS or something similar.
After a bit of digging I found that for me the problem was caused by Assetic which was recompiling all assets on every page load:
http://symfony.com/doc/current/cookbook/assetic/asset_management.html#dumping-asset-files-in-the-dev-environment
By disabling the use of the Assetic controller I was able to drastically increase my page load. However, as the link above states, this comes at a cost of regenerating your assets whenever you make a change to them (or set a watch on them).
In app_dev, all the caches and auto loading is starting from scratch and what I found to be most slow in dev is the orm. I shy away from using orm and focus mainly on dbal because of it, although i probably shouldn't. Orm is used quite a bit in sf2. My guess is orm is what's slowing you down most in dev. Look at the difference between your dev config and prod config. However, some tweaks to your dev config can make development much snappier and enjoyable.. Just try and be aware of what your doing. for example, turning off the twig controller and then modifying a lot of templates will be kind of frustrating. Your need to keep clearing your cache. But like you mentioned, its dev only and when its time to go live, symfony will speed up for you.

Topshelf multiple host

Is there any way in topshelf to run multiple host in one executable?
// Create hosts
var h1 = HostFactory.New (...); var h2 = HostFactory.New (...)
// Start hosts
in one application Runner.Run (h1, h2);
Edit
Solved with threads. But not sure if it is safe...
new Thread (()=>Runner.Run (h1));
new Thread (()=>Runner.Run (h2));
From Topshelf docs:
You can only have ONE service! As of 3.x Topshelf the base product no
longer support hosting multiple services. This was done because the
code to implement was very brittle and hard to debug. We have opted
for a simpler and cleaner base product. This feature will most likely
come back in the form of an add on nuget.
Note: This is only valid for pre-3.0 version of Topshelf. In 3.0 this was removed and is being replaced with other methods of hosting multiple services.
There is no way to run multiple hosts. Starting a host blocks execution, does a whole bunch of stuff. You can register multiple logical services in a single host though.
https://github.com/Topshelf/Topshelf/wiki/Creating-a-service
return (int)HostFactory.Run(x => {
x.Service<Service1>({ ... });
x.Service<Service2>({ ... ]);
});
All logical services run under a single AppDomain. This may or may not be an issue. If you need to host them in separate AppDomains, we started working on shelving. http://topshelf-project.com/documentation/shelving/ As a warning, if you're going to start multiple logical services with the same type, make sure they have unique names when configured.

List of cached objects (including primary/secondary location) by key in AppFabric cache

I have AppFabric installed and working great caching my ASP.Net Sessions. I have 3 W2k8 Enterprise servers as my cache hosts. I created my cache with the Secondaries=1 option. I'm trying to test the High Availability option. In order to do this, I would like to login to my website, find the cache server that has my session and unplug it from the network (simulating a server crash). If I can still work as a logged in user, I can prove that High Availability is working and the secondary copy of my session was promoted.
How can I see a list of the objects in the cache and where the primary/secondary objects "live"?
The get-cache Powershell command can show you your caches running in a cluster, and where their objects (and regions) are located.
Use this code to get all cache objects. Be careful though because depending on your cache size it can take a significant amount of time to dump all cache objects:
foreach (var regionName in cache.GetSystemRegions())
{
foreach (KeyValuePair<string, object> cacheItem in cache.GetObjectsInRegion(regionName))
{
// TODO: process cacheItem.Key and cacheItem.Value
}
}

How can I clear Magento Cache when using a Memcached server

I've been running on a problem for about two weeks.
I Have a magento which is configured to use a memcache server.
Recently, I got to change the server storing my magento application.
I installed my new server, and just get my magento app up and running on the new server, with one change : I changed the database user and password used to connect to the database server.
I changed from userold to usernew.
This change takes place in my local.xml file.
But now, when I active the magento cache, Magento tries to connect to my database with the old username : userold.
I've tried all things :
rm -fR var/
/etc/init.d/memcache restart
killall memcached
reboot the entire server running memcached!
I still have my cache problem ! I can't get my
Where does this "userold" value is fuc*** stored ?
Any help would really be appreciated ! :)
Hugues.
telnet into the memcache instance and issue a flush_all command. Restarting the memcache server should have already flushed it, but sometimes its worth a try...
Magento uses TwoLevels backend for caching.
Cache stores to both of them.
And according to Zend's code, Magento reads from fast, and then from slow, if nothing returns.
You have to flush memcache and remove /var/cache at the same time.
start a new instance of memcache on a new port eg 11212
now specify this new port in local.xml
that should ensure that it is talking to a new instacne not the old.. or
use htop / top find find the psid of memcache and kill xxxx

Resources